Results 1 to 2 of 2

Thread: src of the mouse clcik

  1. #1

    Thread Starter
    Addicted Member TheGoldenShogun's Avatar
    Join Date
    Mar 2001
    Location
    VA/MD... anywhere around the beltway
    Posts
    236

    Angry src of the mouse clcik

    javascript question that I cant seem to figure out. Without passing the src through the tag itself <img onclick=findit(this)> how do I find what the src element and src name are through javascript... I was playing around with window.event and all I can get is window.event.target to bring up that its an HTMLImageObject. That's not what I'm looking for. I want to know the objects name so I can modify it. Any ideas?

  2. #2
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    like this?

    You can toggle the name attribute too; objectID.name='image2';. And, you can also exchange name for id if you are coding XHTML.

    Code:
    <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
    
    <html>
      <head>
        <title>Test</title>
          <script language="JavaScript" type="text/javascript">
           <!--
             function findIt(objectID){
               alert (objectID.name);
    			}
           //-->
          </script>
      </head>
      <body>
        <img name="image1" onclick="findIt(this);">
      </body>
    </html>
    SPREAD THE WORD!!! Are You Lee McCormick? Because I Am



    Lee M McCormick
    [email protected]

    Lee McCormick.com - Live
    Dynamically Webbed.com - In development but live

Posting Permissions

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



Click Here to Expand Forum to Full Width