Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 8 of 8
  1. #1
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts

    image hyperlink problem

    Hi

    i have a script that changes an image in the main frame when you hover over a hyperlink in the navigation frame.

    however i would like to extend this and make the image that appears to be a hyperlink.

    the code i have is below. the navigation frame:-

    Code:
    <script language="JavaScript">
    
    internet_main = window.parent.internet_main("internet_main.html","rollWindow","internet_main");
    
    function getRolling(whichBrief)
    	
    	{
    	internet_main.document.images.rollpic.src = whichBrief;
    	}
    
    </script>
    
    <li><font color="#DB241C">Residential</font>
    <ul>
    <li><a href="desktop" TARGET="internet_main" onMouseOver="getRolling(desktop')">> Orb Surftalk Extra</a></li>
    <li><a href="desktop" TARGET="internet_main" onMouseOver="getRolling(desktop)">> Orb Surftalk Extra +</a></li>
    				</ul>
    			</li>
    Code:
    the main frame:-
    
    <script language="JavaScript">
    
    a=new Image();a.src="desktop\blank.png";
    
    </script>
    
    <img src="desktop\blank.png" name="rollpic">
    thanks in advance

  • #2
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    You could possibly dynamically apply the onclick event to the image and pass the appropriate url

    function getRolling(whichBrief,url){
    internet_main.document.images.rollpic.src = whichBrief;
    internet_main.document.images.rollpic.onclick=function(){
    location=url
    }

    }
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #3
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts
    not sure how this would work if i had 4 hyperlink, each wioth a different image displayed on hover.

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    If you try it you will see
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #5
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i've put into my code, but it doesn't seem to work, where is it getting the url from for a particular image?

  • #6
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    The links in your navigation page would go something like this

    <a href="#null" onmouseover="parent.rightframe.showImage('pic01.jpg','http://www.google.com')">Link</a><BR>
    <a href="#null" onmouseover="parent.rightframe.showImage('pic02.jpg','http://www.mozilla.org')">Link</a><BR>
    <a href="#null" onmouseover="parent.rightframe.showImage('pic03.jpg','http://www.google.com')">Link</a><BR>
    <a href="#null" onmouseover="parent.rightframe.showImage('pic04.jpg','http://www.mozilla.org')">Link</a><BR>
    Last edited by Mr J; 10-25-2006 at 08:51 PM.
    The silent one.

    The most dangerous thing in the world is an idea.
    The most dangerous person in the world is the one with an idea.

  • #7
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts
    i've nearly got it working however when you click on the image it changes the navigation frame and the main frame, i have tried changing the code but not getting anywhere. i have changed your code slightly to get to work so far.

    Code:
    <a href="#null" onmouseover="getRolling('C:/Documents and Settings/Kpatel/Desktop/Orb_Website/Internet Inside Page Layout/orb_surftalk_extra_brief.png','C:/Documents and Settings/Kpatel/Desktop/Orb_Website/Internet Inside Page Layout/orb_surftalk_extra_plan.html')">> Orb Surftalk Extra</a>

  • #8
    Kal
    Kal is offline
    Regular Coder
    Join Date
    Dec 2005
    Posts
    309
    Thanks
    0
    Thanked 0 Times in 0 Posts
    All fixed now, thanks Mr J for all your help, much appreciated.


  •  

    Posting Permissions

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