Results 1 to 4 of 4

Thread: Need Help for a novice: Image on and off

  1. #1
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Need Help for a novice: Image on and off

    I have a page that i am trying to design with image on and off states.
    On the page, i have 6 pictures at people at the top --- then the user can click on the image ---the page reloads because I am passing the pubid varable in the url and the text below the image changes.

    What i am having trouble with is
    1. I want the picture to remain "on" when the page reloads so the user know the text is associated with that person. .

    It seems like it should be easy but i can't get anywhere with it.. i am just going in circles...
    here is an example of what i am working with---
    (I am open to completely starting over if there is a better approach...)

    Thank you...thank you for any help in advance.......

    <script type="text/javascript">
    <!--
    function switchimage(imgDocID,imgObjName)
    {
    document[imgDocID].src = eval(imgObjName + ".src");
    }
    img1 = new Image(90,90);
    img1.src = "../images/personA.jpg";
    img2 = new Image(90,90);
    img2.src = "../images/personA_off.jpg";
    img3 = new Image(90,90);
    img3.src = "../images/personB.jpg";
    img4 = new Image(90,90);
    img4.src = "../images/personB_off.jpg";
    //-->
    </script>

    <a href="alumni_stories.jsp?pubID=1705" onmouseover="switchimage('personA','img1');" onmouseout="switchimage('personA','img2');"><img src="../images/personA_off.jpg" name="personA" width="90" height="90" border="0"></a>

    <a href="alumni_stories.jsp?pubID=1595" onmouseover="switchimage('personB','img3');" onmouseout="switchimage('personB','img4');"><img src="../images/personB_off.jpg" name="personB" width="90" height="90" border="0"></a>

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    If you want to use jsp for this, you need to catch the data on the reloaded page and have it not only change the text but also adjust the highlighting to your requirements. But, you could abandon jsp for this and use instead javascript to change both the text and highlighting without reload.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

  3. #3
    Join Date
    Apr 2007
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Thank you I appreciate your recommendation. I tried locating an example of this type of javascript but couldn't find one that seemed to have this functionality. Is there one you can direct me to? or a certain type of script i should look for, onclick? Thank you

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    Since you mention it, I don't recall seeing any scripts for that around though there may be plenty. Anyways, I decided to write one:

    http://home.comcast.net/~jscheuer1/s...ght_cap_oo.htm
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

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