I have been reading the post and the FAQ and have been unable to find
anything that will help with my problem.
First let me say that I am not a web developer, designer and no next to
nothing about javascript. I am just rebuilding my site and need help. We run
a bamboo nursery and the site has listings of over 100 varieties we sell.
The site uses regular pages and framesets for the discriptions of the
bamboo. The framesets have a top frame, left frame and main frame.
The left frame has a listing of all our varities which can be sorted in
several ways (height, diam. etc). Clicking on a variety loads the
description for the variety in the main frame. All of these files are
located in a directory called bamboo-frames.
We also have frames sets with the same layout that gives the user the
opprotunity to select a sub set of varieties by use. These files are located
in a directory called bamboo-uses but the lelt frame calls the description
page from the bamboo-frames directory.
The main frame for both the above sorts has the following starting mainframe
code:
Head
<script language=javascript
src="../bamboo-cookies/bamboo-cookies.js"></script>
body
<SCRIPT LANGUAGE="JavaScript">
<!--
var pic = getCookie("sizepic");
if (!pic) {
pic = "Full size";
setCookie('sizepic', pic);
}
// -->
</SCRIPT>
My html code
<form>
<input name="" type="button" onClick="setCookie('sizepic','Full size') "
value="Full size">
<input name="" type="button" onClick="setCookie('sizepic','Half size')"
value="Half size">
<input name="" type="button" onClick="alert(getCookie('sizepic'))"
value="Current size">
</form>
The functions were downloaded and pasted into bamboo-cookies.js
Clicking on the alert button will give the correct results regardless of the
starting main frame.
On the description pages if have the following code:
head
<script language=javascript
src="../bamboo-cookies/bamboo-cookies.js"></script>
body
My html
<SCRIPT LANGUAGE="JavaScript">
<!--
var pic = getCookie("sizepic");
switch(pic)
{
case "Full size":document.write("<img src='../bamboo-photos/bamboo-0105.jpg'
alt='Bamboo - P. bambusoides tanakae' width='480' height='640'
hspace='10'>");
; break
case "Half size": document.write("<img
src='../bamboo-photos50/bamboo-0105.jpg' alt='Bamboo - P. bambusoides
tanakae' width='240' height='320' hspace='10'>");
; break
default: document.write("<img src='../bamboo-photos/bamboo-0105.jpg'
alt='Bamboo - P. bambusoides tanakae' width='480' height='640'
hspace='10'>");
; break
}
//-->
</SCRIPT>
When calling the description page from the bamboo-frames directory the
correct size photo is download with the page.
When calling the description page from the bamboo-uses directory the last
size called from the bamboo-frames directory is used even though the buttons
apparently change the cookie value.
In the comments of the setCookie function it says the default directory is
path=/ so I do not pass a value.
I don't understand all that is happening but hope someone can see what I am
doing wrong. I have been trying to get this to work for 4 days now and am
really frustrated by my lack of knowledge.
Any guidance appreciated.
Bert