Results 1 to 3 of 3

Thread: disabling links in a HTML page

  1. #1

    Thread Starter
    New Member
    Join Date
    Nov 2000
    Posts
    13
    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?

  2. #2
    Frenzied Member Mark Sreeves's Avatar
    Join Date
    Nov 1999
    Location
    UK
    Posts
    1,845
    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>
    Mark
    -------------------

  3. #3
    Conquistador
    Join Date
    Dec 1999
    Location
    Australia
    Posts
    4,527
    http://www.bratta.com

    has some good examples of dhtml

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width