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 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Onclick Stay Question for IE7

    Hello,
    I'm looking for a solution to an IE7 issue...the following code is for an "onclick stay" meaning that when the user clicks on a graphic the "on" graphic stays until a different graphic is clicked. This works great on all of the other browsers without any problems...except IE7... Has anyone come up with a solution? Thank you!

    CODE:
    <script language="JavaScript">
    <!-- Hide from old browsers


    if (navigator.appVersion.indexOf("2.") != -1){
    check = false;
    }
    if ((navigator.appVersion.indexOf("3.") != -1) && (navigator.appName.indexOf("Explorer") != -1)){
    check = false;
    }
    else {
    check = true;
    }
    if (check == true){
    image1 = new Image();
    image1.src = "IMAGE OFF #1";
    image1on = new Image();
    image1on.src = "IMAGE ON #1";
    image1stay = new Image();
    image1stay.src = "IMAGE STAY #1";

    image2 = new Image();
    image2.src = "IMAGE OFF #2";
    image2on = new Image();
    image2on.src = "IMAGE ON #2";
    image2stay = new Image();
    image2stay.src = "IMAGE STAY #2";
    }

    imageStay = ""

    function imageon(name){
    if (imageStay != name){
    document[name].src = eval(name + "on.src");
    }
    }
    function imageoff(name){
    if (imageStay != name){
    document[name].src = eval(name + ".src");
    }
    }

    function on(name){
    if (check == true){
    imageon(name);
    }
    }
    function off(name){
    if (check == true){
    imageoff(name);
    }
    }

    function stay(name){
    if (check == true){
    document[name].src = eval(name + "stay.src");
    if (imageStay != name){
    if (imageStay != ""){
    document[imageStay].src = eval(imageStay + ".src");
    }
    }
    imageStay = name
    }
    }
    // -->
    </script>

    <a href="YOUR LINK" target="FRAME NAME" onMouseOver="on('image2');" onMouseOut="off('image2')" onClick="stay('image2');"><img src="IMAGE OFF #2" border="0" name="image2"></a><br>

  • #2
    Banned
    Join Date
    May 2006
    Location
    England
    Posts
    664
    Thanks
    0
    Thanked 84 Times in 84 Posts
    Quote Originally Posted by koacamper View Post
    Hello,
    I'm looking for a solution to an IE7 issue...the following code is for an "onclick stay" meaning that when the user clicks on a graphic the "on" graphic stays until a different graphic is clicked.
    That looks like very old and substandard code. This is a job for SmartRoll.


  •  

    Posting Permissions

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