Results 1 to 5 of 5

Thread: Putting focus on image

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Posts
    150

    Putting focus on image

    Hi all,

    Is there a way of
    When you tab along of putting the focus on a <IMG tag that contains an image other than using the <A or <button tag?

  2. #2

    Thread Starter
    Addicted Member
    Join Date
    Oct 2001
    Posts
    150
    Or can i put something in the HREF=???? So that there will be no link . I will only use the event OnKeypress,OnMouseUp Etc....

    Because when you press on the image i am calling a Javascript function and the HREF doesnt take JavaScript

    Thanks

  3. #3
    Fanatic Member punkpie_uk's Avatar
    Join Date
    Sep 2001
    Location
    UK
    Posts
    645
    you are correct when you say that "href doesnt take javascript" but thats not the only way get javascript to occur upon clicking the mouse on an anchor tag.

    The anchor tag supports html 4.01 core attributes so you can use onclick... eg.

    Code:
    <a href="#" onclick="aJavascriptFunction()">This is a link</a>
    This is same for the <img> tag too...

    Code:
    <img src="image1.jpg" onclick="aJavascriptFunction()" />
    Take a look at this information http://www.devguru.com/Technologies/...tml_index.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

  4. #4
    Hyperactive Member bsw2112's Avatar
    Join Date
    Nov 2001
    Location
    ottawa, canada
    Posts
    292
    you are correct when you say that "href doesnt take javascript"
    I see that a lot but don't understand when href cannot take javascript. what about href="javascript:functionName()"

    regards

    bsw2112

  5. #5
    Fanatic Member cpradio's Avatar
    Join Date
    Apr 2002
    Posts
    616
    href= attrubte:

    The href attribute will only run javascript code if explicity told to do so ie: href="javascript:functionName();" If you attempt to run a function without telling the browser it's javascript it will think you are attempting to located another html page.

    -Matt
    http://cpradio.net/
    Administrator @ WDForums and a Moderator @ WebXpertz City Forums

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