javascript problem

Discussion in 'Windows - Software discussion' started by arrgghh, Mar 18, 2008.

  1. arrgghh

    arrgghh Member

    Joined:
    Oct 6, 2005
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    16
    i was trying to write a simple script to do an image button, im not sure why the code doesnt work. I have a working script already but was trying to make a generic function.

    function ImageOver(a,b)
    {
    document.images[a].src=b;
    return true;
    }

    when i try to pass the parameters it doesnt work, for example...

    <a href="1.2.3.4" onmouseover="return ImageOver("jsbutton1","picture.gif")" >
    </a>

    im not sure why it wont work, it seems so simple. Im thinking maybe the quotations are being stripped when passing the params, but not sure. Any suggestion would be helpful.
     
    Last edited: Mar 18, 2008
  2. varnull

    varnull Guest

  3. arrgghh

    arrgghh Member

    Joined:
    Oct 6, 2005
    Messages:
    55
    Likes Received:
    0
    Trophy Points:
    16
    if i try this it works but its not what i want, im not sure why it doesnt seems to work.

    function ImageOver(a,b)
    {
    a = "jsbutton1";
    b = "picture.gif";
    document.images[a].src=b;
    return true;
    }

    but it doesnt work when passing parameters.

    when i try to pass the parameters it doesnt work, for example...

    <a href="1.2.3.4" onmouseover="return ImageOver("jsbutton1","picture.gif")" >
    </a>

    any more suggestions why this wont work?
     

Share This Page