Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    Regular Coder
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    302
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Question changing title spec in anchor tag?

    I have some links that open in popup windows. I'd like to have a message when the cursor goes over the link to indicate that it is a "popup". I know I can do this with the title spec. But I only want it to show up only if javascript is enabled. I'd like a different title spec for viewers who have javascript disabled.

    I have come up with the first version but it is a little unwieldy.

    Code:
    <a href="blahblah.html" 
    onclick="window.open('blahblah.html', 'popup', 'scrollbars=1,resizable=1,width=590,height=400,left=20,top=20'); return false;" title="blah blah">
    blah blah link <script>
    document.write("(opens in a popup window)");
    </script></a>
    This second version is my attempt at putting a "noscript" inside the anchor tag. But, of course, this doesn't work.

    Code:
    <a href="blahblah.html" 
    onclick="window.open('blahblah.html', 'popup', 'scrollbars=1,resizable=1,width=590,height=400,left=20,top=20'); return false; document.write(title='blah blah opens in a popup window ');" 
    title="blah blah">blah blah link</a>
    Is there some way of doing this so that the title spec in javascript-enabled browsers will be "blah blah opens in a popup window" and in javascript-disabled browsers will be "blah blah"? (I hope my question made some sort of sense.)

  • #2
    Banned
    Join Date
    Sep 2003
    Posts
    3,620
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Use an onmouseover event handler and setAttribute

    eg:
    Code:
    <a href="blahblah.html" title="blah blah"
    onmouseover="this.setAttribute('title','this is a javascript popup link')"
    onclick="window.open(this.href, 'popup', 'scrollbars=1,resizable=1,width=590,height=400,left=20,top=20'); return false">blah.html</a>
    .....Willy
    Last edited by Willy Duitt; 04-23-2004 at 08:07 AM.

  • #3
    Regular Coder
    Join Date
    Apr 2004
    Location
    Canada
    Posts
    302
    Thanks
    2
    Thanked 0 Times in 0 Posts

    Thumbs up

    Aha! Thank you, Willy! That works perfectly.


  •  

    Posting Permissions

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