Tag Archives: dhtml examples

Event on Double click

Event on Double Click <html> <head> <script> function gettip(txt) { document.getElementById(‘tip’).innerHTML=’is about Create websites by using scripting technologies for the World Wide Web’; } </script> </head> <body> <p>Double click the “Paktutorial.com”</p> <table> <tr> <th valign=”top”>Paktutorial.com</th> <th> </th> </tr> </table> </body> </html> OUTPUT: Double click the “paktutorial.com” Paktutorial.com

Event OnChange

Event OnChange: <html> <head> <script> function preferedBrowser() { prefer=document.forms[0].browsers.value; alert(“You prefer browsing internet with ” + prefer); } </script> </head> <body> <form> Choose which browser you prefer: <select onchange=”preferedBrowser()”> <option value=”Internet Explorer”>Internet Explorer</option> <option value=”Firefox”>Firefox</option> <option value=”Chrome”>Chrome</option> <option value=”Opera”>Opera</option> </select> </form> </body> </html> OUTPUT: Choose which browser you prefer: Internet ExplorerFirefoxChromeOpera

Event Examples

EVENT EXAMPLES HTML Event Onload <html> <head> <script> function mymessage() {alert(“This message was triggered from the onload event”);} </script> </head> <body> </body> </html> HTML Event Onunload <html> <head> <script> function ­mymessage() {alert(“This message was triggered from the onunload event”);} </script> </head> <body> <p>An alert box will display a message when you close this document!</p> </body> […]

Change Background Color

Change Background Color <html> <head> <script> function bgChange(bg) { document.body.style.background=bg; } </script> </head> <body> <b>Mouse over the squares and the background color will change!</b><table width=”300″ height=”100″> <tr> <td onmouseover=”bgChange(‘red’)” onmouseout=”bgChange(‘transparent’)” bgcolor=”red”></td> <td onmouseout=”bgChange(‘transparent’)” bgcolor=”blue”></td> <td onmouseover=”bgChange(‘green’)” onmouseout=”bgChange(‘transparent’)” bgcolor=”green”> </td> </tr> </table> </body> </html> Mouse over the squares and the background color will change!