Results 1 to 7 of 7

Thread: Loose Focus/no Focus onclick set focus to nothing/opening a page where there is none!

  1. #1
    Join Date
    Dec 2007
    Posts
    88
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Loose Focus/no Focus onclick set focus to nothing/opening a page where there is none!

    Hi, I would like to do the following.

    I have an href where onclick the focus is on the href:
    I got it to change focus to another object but i don't really want that.

    It must be as if the user clicked nothing. The href is what i use for my tooltip so it's only surppose to work onmouseover!

    This is the jscript:
    onClick="document.getElementById('__Submit').focus();"

    The __Submit' is another object - i' setting the focus to


    XSLT code i'm using:

    <a>
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>document.getElementById('__Submit').focus();</xsl:attribute>
    <img src="images/help.jpg" align="texttop" style='border : none;'></img>
    </a>

    Please Help!

    Regards

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    I'm not familiar with this XSLT stuff, but it looks fairly straightforward. Assuming all of your other code is valid and working:

    Code:
    <a> 
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>document.getElementById('__Submit').focus();return false;</xsl:attribute>
    <img src="images/help.jpg" align="texttop" style='border : none;'></img>
    </a>
    will cancel the link's normal behavior of navigating to, in this case - '#'.

    However, I see a potential problem in that onClick isn't strictly an attribute, and if treated exclusively as one, it probably won't fire.
    - John
    ________________________

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

  3. #3
    Join Date
    Dec 2007
    Posts
    88
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Unfortunately still unsuccessfull

    Hi, Thank You for the help!

    But unfortunately it still sets the focus to the __Submit.

    No error nothing - it moves the focus to the ___Submit.

    Please Assist!

    Regards

  4. #4
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    I misunderstood because it seemed like you wanted the focus to shift. If you want the link to do nothing:

    Code:
    <a> 
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>return false;</xsl:attribute>
    <img src="images/help.jpg" align="texttop" style='border : none;'></img>
    </a>
    This still assumes that the onClick will fire, which - if you were having the focus shift on you, it will. Just now though, when it fires, it won't do anything, not even navigate. Any onmouseover characteristics that are assigned to it by other code should still work.
    - John
    ________________________

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

  5. #5
    Join Date
    Dec 2007
    Posts
    88
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question Thank You but not what i really wanted

    Hi, Thank you for the assist!

    The link does nothing but i want the focus to move off the href(image) as
    i want the user not be able to click on the image.

    because when click it sets focus to the image with a border around it!

    I'm using the href for the soultion to the tooltip problem i had!
    where the user just mouseover & tooltip will display!

    but now becuase is changed to an href - user can click & image/href as focus
    i actually want it not to have focus

    - can i maybe disable the onclick - as in no click?

    This was used to move focus off the href but now i can't find anything else to hide the focus!
    <xsl:attribute name='onClick'>document.getElementById('___Submit').focus();return false;</xsl:attribute>

  6. #6
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    29,030
    Thanks
    44
    Thanked 3,211 Times in 3,173 Posts
    Blog Entries
    12

    Default

    With border:none; for the image, there should be no border. I think you may be referring to the outline. Try:

    Code:
    <a style="outline-style:none;"> 
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>return false;</xsl:attribute>
    <img src="images/help.jpg" align="texttop" style='border : none;outline-style:none;'></img>
    </a>
    Since this is xsl though, you may need to put style in an xsl stylesheet.

    But, no matter what you do, people can click anywhere they like. All you can do is configure what happens when they do. Browsers can still override that with user defined settings.

    Now, if the tip didn't depend upon a link, I'd use a span. From your code it looks like a link is required - rel isn't an attribute of span, and the tip code may only be looking at links.

    There are other tool tip scripts that can work with any element though.

    Another thing to try:

    Code:
    <a> 
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>this.blur();return false;</xsl:attribute>
    <img src="images/help.jpg" align="texttop" style='border : none;'></img>
    </a>
    - John
    ________________________

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

  7. #7
    Join Date
    Dec 2007
    Posts
    88
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Smile Great!!! Thank You

    Hi, Thank You very much for your kindness & help - Great stuff

    I found that i had to add the onBlur as it did not work without that!

    code:
    <a style="outline-style:none; cursor:default;">
    <xsl:attribute name='href'>#</xsl:attribute>
    <xsl:attribute name='rel'>ttip_<xsl:value-of select='@name' /></xsl:attribute>
    <xsl:attribute name='onClick'>this.blur();return false;</xsl:attribute>
    <img src="images/help.jpg" align="texttop" border="0" style='border : none; cursor:default; outline-style:none;'></img>
    </a>

    Thank You !!!

    Regards

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
  •