PDA

View Full Version : Javascript and the rel attribute



drmeisner
03-24-2009, 06:57 PM
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

???
03-24-2009, 09:04 PM
A lame way to do it:


<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

drmeisner
03-24-2009, 11:06 PM
Thanks Stephen, I will give it a try and let you know how it goes...

drmeisner
03-24-2009, 11:59 PM
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

???
03-28-2009, 03:28 AM
What you have above is obviously not all your code. If you provide some more I might be able to take a better look.