Advanced Search

Results 1 to 5 of 5

Thread: Javascript and the rel attribute

  1. #1
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default Javascript and the rel attribute

    I have a piece of code that makes a button, and when clicked opens a video overlay based on the div id. The code relies on the rel attribute to make this happen. However, the rel attribute is not recognized in XHTML 1.0 Transitional. How can I use a javascript event such as onclick to generate the part of the code need for the rel attribute, and thus make the completed button tag w3c compliant? Here is my code snippet below:
    [CODE]
    <div align="center">
    <button rel="#overlayvideo" style="background-color:#3db3e0; font-variant:small-caps;">Play Video</button>
    </div>
    </div>
    <div class="videooverlay" id="overlayvideo" style="background-image:url(http://www.copycatdigital.ca/scripts/flowplayer_scripts/blue.png)">
    <a class="player" href="http://www.copycatdigital.ca/ccdad.flv">
    &nbsp; </a> </div>

    Thanks!
    Dwayne

  2. #2
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    A lame way to do it:
    Code:
    <button onclick="window.location.hash = '#overlayvideo';" style="background-color:#3db3e0; font-variant:small-caps;">Play Video</button>
    I think it would work.

    Hope it helps,
    Stephen

  3. #3
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Thanks Stephen, I will give it a try and let you know how it goes...

  4. #4
    Join Date
    Oct 2007
    Posts
    32
    Thanks
    1
    Thanked 0 Times in 0 Posts

    Default

    Hello Stephen, it did not work. The button behaved like it was being pushed, but nothing happened. I will have to check further tomorrow.

    Thanks,
    Dwayne

  5. #5
    Join Date
    May 2006
    Location
    Alaska
    Posts
    163
    Thanks
    5
    Thanked 2 Times in 2 Posts

    Default

    What you have above is obviously not all your code. If you provide some more I might be able to take a better look.

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
  •