-
Hi,
I hope I have come to the right place to ask this.
I am programming a web site where each page has three frames. The right frame is a navigation frame and the two left frames usually display some content. The middle frame contains the most important information.
Anyway, I need to make things such that when the middle frame is being displayed, the relevant link in the menu frame cannot be clicked upon and the text to be a different colour.
What sort of DHTML code do I need to add such that this will work on both Netscape and IE?
-
OK I hope you're ready for this! :)
there may be other ways of doing it but this does actually work!
You'll need to add code to ensure javascript is enabled.
(works in netscape 4 as well)
the hyperlinks for you navigation page are in the array called 'links' in control.html
put all your links there
if you want alternative captions you could use a 2D array with captions in the second element.
frames.html
Code:
<frameset cols="200,*,200">
<frameset rows="*,0">
<frame name=frmLeft src=blank.html>
<frame name=frmControl src=control.html>
</frameset>
<frame name=main src=blank.html>
<frame name=frmRight src=blank.html>
</frameset>
blank.html
Code:
<HTML>
<BODY>
</BODY>
</HTML>
display.html
Code:
<HTML>
<body bgColor=#9bbad6 onLoad="parent.frmControl.showPage();">
</BODY>
</HTML>
control.html
Code:
<HTML>
<script language=javascript>
var linkID;
var links=new Array();
links[0]= "cwleft.html"
links[1]= "http://forums.vb-world.net"
links[2]= "cwpage1.html"
function showPage()
{
parent.main.location=links[linkID]
redrawmenu(linkID)
}
function redrawmenu()
{
var j;//loop counter
parent.frmLeft.document.write('<HTML>');
parent.frmLeft.document.write('<HEAD>');
parent.frmLeft.document.write('<script language=javascript>');
parent.frmLeft.document.write('function doIt(id)');
parent.frmLeft.document.write('{\n');
parent.frmLeft.document.write('parent.frmControl.linkID=id;\n');
parent.frmLeft.document.write('parent.frmLeft.location=\'display.html\';\n');
parent.frmLeft.document.write('}\n');
parent.frmLeft.document.write('<\/script>');
parent.frmLeft.document.write('<\/HEAD>');
parent.frmLeft.document.write('<BODY bgColor=#9bbad6>');
for(j=0;j<links.length;j++)
{
if(i!=linkID)
{
parent.frmLeft.document.write("<A HREF='javascript:doIt(" + j + ")'>" + links[j] + "</A><BR>\n");
}else{
parent.frmLeft.document.write(links[j] + "<BR>\n");
}
}
parent.frmLeft.document.write('<\/BODY><\/HTML>');
}
redrawmenu();
</script>
</HTML>
-
http://www.bratta.com
has some good examples of dhtml