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 2010
    Posts
    214
    Thanks
    116
    Thanked 1 Time in 1 Post

    Very Simple Question about a JS link, but Im pulling my hair out!

    On the surface it looks simple, but here is my question.

    I want to use this CSS button to replace the 'here' text in the bottom script:

    Here is the button code itself:
    Code:
    <a href="#" class="read_more3">Full Specification Sheet</a>

    And here is the script I want to happen when you click on the button. Right now this works, but only if click on the plain text 'here':
    Code:
    <a href = "javascript:void(0)" onclick = "document.getElementById('light').style.display='block';document.getElementById('fade').style.display='block'">here</a>

    Thanks in advance!!!

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,020
    Thanks
    75
    Thanked 4,323 Times in 4,289 Posts
    Code:
    <a href = "#" class="read_more3" 
       onclick = "document.getElementById('light').style.display='block';
                  document.getElementById('fade').style.display='block';
                  return false;">
    Full Specification Sheet
    </a>
    The key is return false. Without that, the <a> tries to do its normal operation.
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • Users who have thanked Old Pedant for this post:

    BlackReef (07-18-2012)

  • #3
    Regular Coder
    Join Date
    Apr 2010
    Posts
    214
    Thanks
    116
    Thanked 1 Time in 1 Post
    Thank You Sir


  •  

    Posting Permissions

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