Assignment GDB Solution: DHTML Examples

loading...

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!

Visibilty Example

Visibilty Example Show and Hide Text <html> <body> <p>This is a text. This is a text. This is a text. This is a text. This is a text. This is a text. This is a text.</p> <input value=”Hide text” onclick=”document.getElementById(‘p1’).style.visibility=’hidden’” /> <input value=”Show text” onclick=”document.getElementById(‘p1’).style.visibility=’visible’” /> </body> </html> OUTPUT: This is a text. This is […]