We help IT Professionals succeed at work.

Still trouble with var url onClick...

radars
radars asked
on
498 Views
Last Modified: 2008-02-26
I've intended to use this script in my schools page..in the topp frame.
The page is still under construction...
http://www.fredly.fhs.no

<HTML>
<HEAD>



      <SCRIPT LANGUAGE="Javascript"><!--
      var IMAGE_COUNT=3;
      var SelectedImage=-1;
      
      var srcsOut = new Array(IMAGE_COUNT);
      var srcsOver = new Array(IMAGE_COUNT);
      var srcsClick = new Array(IMAGE_COUNT);
      var urls = new Array(IMAGE_COUNT);

      srcsOut[0] = "bg_ansa.jpg";
      srcsOut[1] = "bg_elev.jpg";
      srcsOut[2] = "bg_link.jpg";

      srcsOver[0] = "br_ansa.jpg";
      srcsOver[1] = "br_elev.jpg";
      srcsOver[2] = "br_link.jpg";

      srcsClick[0] = "brransa.jpg";
      srcsClick[1] = "brrelev.jpg";
      srcsClick[2] = "brrlink.jpg";

      urls[0]="fakta.htm"
      urls[1]="linker.htm"
      urls[2]="e-mail.htm"

      function doOver(which){
      if(SelectedImage!=which)document.images[which].src=
srcsOver[which];
      }

      function doOut(which){
      if(SelectedImage!=which)document.images[which].src=
srcsOut[which];
      }

      function doClick(which)
      {if(SelectedImage!=-1)document.images[SelectedImage].src=
srcsOut[SelectedImage];
      document.images[which].src=srcsClick[which];
      SelectedImage=which;
      top.window.main.location=urls[which];
      }
      //--></SCRIPT>

</HEAD>
<BODY BGCOLOR=FFFFFF TEXT=000000 LINK=0000FF VLINK=800080>

      <A HREF="Javascript:void(doClick(0))"onMouseOver="doOver(0);
return true" onMouseOut="doOut(0)">
      <IMG SRC="bg_ansa.jpg" BORDER="0"></A>
      <A HREF="Javascript:void(doClick(1))"onMouseOver="doOver(1);
return true" onMouseOut="doOut(1)">
      <IMG SRC="bg_elev.jpg" BORDER="0"></A>
      <A HREF="Javascript:void(doClick(2))"onMouseOver="doOver(2);
return true" onMouseOut="doOut(2)">
      <IMG SRC="bg_link.jpg" BORDER="0"></A>

</BODY>
</HTML>

As u can see.. I want the topframe to be as an indicator so those who visit the page can see what page they are on..(if u understand) But what I also want is that the menu frame on the left can be used the same way on the same time. I want them to coordinate so that they show exactly what page u're on. How do I do that? Do I have to use images or can the same be done with text?
The script above works rather bad in Explorer 3.0.
And most of all I want the function to work in Explorer 3.0 as well as Netscape 3.0!!!
Please help me with examples and explanation!
Comment
Watch Question

MSIE 3.x cannot do what you want.  MSIE 3.x cannot change images on the fly.  As for your code it looks ok.  If you want things to look as if they were getting updated on the fly, then you will have to use images.  If you want text to change the frame would have to be reloaded/refreshed with the new text, unless you wanted to design your site with DHTML.  DHTML is only supported in the 4.x versions of Netscape and MSIE.

Author

Commented:
Not what I asked for!
How can I use the left menu together with the top menu?

Commented:
I've made it with applets.

I've made a Java Applet that works like a button, but it changes two frames, the body frame and the top frame, so when you click on the left side frame buttons you can change at the same time the contens of the 2 other frames.

And when u click on the top side frame, you can do the same.

Author

Commented:
I want an answer in Javascript not as a Java applet!
This one is on us!
(Get your first solution completely free - no credit card required)
UNLOCK SOLUTION
Unlock the solution to this question.
Join our community and discover your potential

Experts Exchange is the only place where you can interact directly with leading experts in the technology field. Become a member today and access the collective knowledge of thousands of technology experts.

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.