[thelist] Creating a global site navigation system...
Oliver Reid
ReidO at cbs.curtin.edu.au
Tue Oct 16 20:32:48 CDT 2001
G'Day Martin,
Sorry, I'm not sure that this is relevant to what I'm trying to do - the actual code written to the page is xhtml.
The code I've already created:
---------------------------------------------------------------------------
function pageNav(eMail,value)
{
headerdata='';
selfVal='';
var fileLocation, lastSlash, lastDot, pageNum;
backValue='';
nextValue='';
//FIND FILE NAME
fileLocation = window.location.href;
lastSlash = fileLocation.lastIndexOf("/");
lastDot = fileLocation.lastIndexOf(".");
pageNum = fileLocation.substring(lastSlash+1,lastDot);
backValue = (Number(pageNum)-1);
nextValue = (Number(pageNum)+1);
headerdata += '<!-- Begin Header Module --><table border="0" cellspacing="0" cellpadding="0" width="99%" height="1%"><tr><td width="1px" class="corner"><img alt="" src="images/green.gif" width="1px" height="1px" /></td><td colspan="3" class="top"><img alt="" src="images/green.gif" width="1px" height="1px" /></td><td width="1px" class="corner"><img alt="" src="images/green.gif" width="1px" height="1px" /></td></tr><tr><td width="1px" rowspan="2" class="side"><img alt="" src="images/spacer.gif" width="1px" height="1px" /></td><td width="150px" align="left" valign="middle" nowrap>'
// MAILTO+ '<a href="mailto:'+ eMail+ '?subject='+ document.title+ '">Contact Lecturer</a></td><td align="center" valign="middle" nowrap>';
//PAGE NUMBERS
if (value<16)
{
//LOOP THROUGH PAGES
for (i=1;i<value;i++)
{
headerdata += '<a href=" '+ i+ '.shtml'+ '">['+ i+ ']</a><span class="white"> :: </span>';
}
headerdata += '<a href="'+ value + '.shtml'+ '">['+ value+ ']</a></td><td width="150px" align="right" valign="middle" nowrap>';
//END LOOP
}
else
{
alert('The maximum allowable value is 15');
}
// BACK
if (backValue>=1)
{
headerdata += '<a href="' + backValue + '.shtml' + '"><< Back</a><span class="white"> :: </span>';
}
else
{
headerdata += '<span class="white"><< Back :: </span>';
}
// NEXT
if (nextValue<=value)
{
headerdata += '<a href="' + nextValue + '.shtml' + '" >Next >></a>';
}
else
{
headerdata += '<span class="white">Next >></span>';
}
headerdata += '</td><td width="1px" rowspan="2" class="side"><img alt="" src="images/spacer.gif" width="1px" height="1px" /></td></tr><tr><td width="150px" align="left" valign="top"><img alt="" src="images/spacer.gif" width="150px" height="1px" /></td><td align="left" valign="top"><img alt="" src="images/spacer.gif" width="200px" height="1px" /></td><td width="150px" align="left" valign="top"><img alt="" src="images/spacer.gif" width="150px" height="1px" /></td></tr><tr><td width="1px" class="corner"><img alt="" src="images/green.gif" width="1px" height="1px" /></td><td colspan="3" class="top"><img alt="" src="images/green.gif" width="1px" height="1px" /></td><td width="1px" class="corner"><img alt="" src="images/green.gif" width="1px" height="1px" /></td></tr></table><!-- End Header Module -->';
MM_setTextOfLayer('headerDiv','',headerdata);
}
---------------------------------------------------------------------------
I'd just like suggestions on how I can expand this, make it more flexible, cross-browser & robust.
Thanks,
Oliver Reid
Web/Multimedia Developer
Research and Development Facility
Information Technology Services
Curtin Business School
Curtin University of Technology
Perth, Western Australia
Tel: +61 8 9266 4903
Fax: +61 8 9266 3767
More information about the thelist
mailing list