R
Robert Baer
The following code "works" in a strange way; see the comments for
details.
1) why is that document.write necessary for operation?
2) why doesn't the altered variable "title" remain changed?
3) i would like to change displayed page, based on map visits
Help? Comments?
<SCRIPT type="text/javascript">
// <img id="page" src=title alt="Codatron page 1">
// src="images/CodatronP1.png"
var title="images/CodatronP1.png";
var dir=-1;
var num=3;
function incrPage(dir,title)
{
num=title.substr(16,1).valueOf();
if (dir===-1)
{
num=num-1;
if (num===0) {num=7;}
}
else
{
num=num+1;
if (num===8) {num=1;}
}
title=title.substr(0,16)+num+title.substr(17);
document.write("###"+title+"*");
// above correct at page 7 being "previous" to page 1 (sequence 1,2,,7,1
etc)
// *NOTE* the document.write MUST exist for the map visits to work ???
}
incrPage(dir,title);
// document.write("***"+title+"* *#");
// above is wrong, with title equal to unchanged initial def
// document.getElementById("page").innerHTML=title;
</script>
<div>
<img src="ShuttleN.png" alt="Select" usemap="#PageSelect"
</div>
<div>
<!-- visiting mapped areas give "###-1*" or "###1*" in new screen -->
<map id="images/CodatronP5.png" name="PageSelect">
<area shape="rect" alt="Minus" coords="65,0,135,35"
src="N.PNG" onMouseover="incrPage(-1,id)" >
<area shape="rect" alt="Plus" coords="590,0,668,35"
src="P.PNG" onMouseover="incrPage(1,id)" >
<area shape="default" nohref="nohref" alt="" >
</map>
</div>
<!-- display page one; would like to change that based on map visits -->
<div class=" container_24">
<div class="wrapper">
<img id="page" src="images/CodatronP1.png" alt="Page">
</div>
</div>
details.
1) why is that document.write necessary for operation?
2) why doesn't the altered variable "title" remain changed?
3) i would like to change displayed page, based on map visits
Help? Comments?
<SCRIPT type="text/javascript">
// <img id="page" src=title alt="Codatron page 1">
// src="images/CodatronP1.png"
var title="images/CodatronP1.png";
var dir=-1;
var num=3;
function incrPage(dir,title)
{
num=title.substr(16,1).valueOf();
if (dir===-1)
{
num=num-1;
if (num===0) {num=7;}
}
else
{
num=num+1;
if (num===8) {num=1;}
}
title=title.substr(0,16)+num+title.substr(17);
document.write("###"+title+"*");
// above correct at page 7 being "previous" to page 1 (sequence 1,2,,7,1
etc)
// *NOTE* the document.write MUST exist for the map visits to work ???
}
incrPage(dir,title);
// document.write("***"+title+"* *#");
// above is wrong, with title equal to unchanged initial def
// document.getElementById("page").innerHTML=title;
</script>
<div>
<img src="ShuttleN.png" alt="Select" usemap="#PageSelect"
</div>
<div>
<!-- visiting mapped areas give "###-1*" or "###1*" in new screen -->
<map id="images/CodatronP5.png" name="PageSelect">
<area shape="rect" alt="Minus" coords="65,0,135,35"
src="N.PNG" onMouseover="incrPage(-1,id)" >
<area shape="rect" alt="Plus" coords="590,0,668,35"
src="P.PNG" onMouseover="incrPage(1,id)" >
<area shape="default" nohref="nohref" alt="" >
</map>
</div>
<!-- display page one; would like to change that based on map visits -->
<div class=" container_24">
<div class="wrapper">
<img id="page" src="images/CodatronP1.png" alt="Page">
</div>
</div>