HTML5 Event Handler Content Attributes

So I’m pretty sure there are millions of people online who are experts in HTML5, I do not consider myself and will never label myself as an expert.

But I just love learning and experminent with code, HTML, CSS3, Javascript on good days, and love getting coffee at Stumptown Coffee in Capitol Hill.

My English is horrible so I’m sorry ahead of time.  So I’m going to test a few lines of code:

The first one is oncanplay. Hmmm….let’s lets see how this works?

<script id="oncanplaysample">
function coolbeans(){
document.getElementById("video1").style.borderColor = 'red';
document.getElementById("video1").style.borderWidth = '5px';
document.getElementById("video1").style.borderStyle = 'solid';

You can also use oncanplaythrough which the media can be played to the end. Here is another that I used for and
it’s the oncontextmenu event handler. This one is used in different scenarios. I can’t think of anything amazing but I use it prevent a right click
on my website.  I know programmers know how to take images and view the source code regardless of disabling the right click but it helps a little bit from
other people who constantly abusing it without giving someone credit.  So I will give you an example of how to use oncontextmenu

<div oncontextmenu="true"> This is basically useless</div>
<div oncontextmenu="return false"> Try Right Clicking this Div Box or Image </div>  <!-- look below this example -->
Useless Div
Try Right Clicking this Div Box or Image seattle-google-wordpress

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.