<script type="text/javascript" src="showHide.js"> </script> </head> <body> <form action=""> <div id="rnsit" style="position:relative; visibility: visible;"> <img src = "CLASS PHOTO.jpg" alt = "RNSIT CSE 2009-2013" /> </div> <p><br><input type="button" value="Toggle Rnsit" onclick = "flipImag()" /></p> </form> </body> </html> //showHide.js function flipImag() { if(dom.visibility == "visible") dom.visibility = "hidden"; else dom.visibility = "visible"; } 6. With an example of XHTML doc with java script, explain dynamic content (10 Marks) (July-2014). Solution: DYNAMIC CONTENT now develop an example that illustrates one use of dynamic content. We to a browser user filling out a form can be provided with an Assistance associated text area, often called a help box. content of the help box can change, depending on the placement of the The mouse cursor. the cursor is placed over a particular input field, the help box can display When advice on how the field is to be filled in. When the cursor is moved away from an input field, the help box content can be changed to simply indicate that assistance is available. the next example, an array of messages that can be displayed in the help box In is defined in JavaScript. the mouse cursor is placed over an input field, the mouseover event is When used to call a handler function that changes the help box content to the appropriate value appropriate value is specified with a parameter sent to the handler function. The The mouseout event is used to trigger the change of the content of the help box back to the value. “standard” //dynValue.html <html> <head> <title>Dynamic Values</title> <script type = "text/javascript" src = "dynValue.js"> </script>
<script type="text/javascript" src="showHide.js"> </script> </head> <body> <form action=""> <div id="rnsit" style="position:relative; visibility: visible;"> <img src = "CLASS PHOTO.jpg" alt = "RNSIT CSE 2009-2013" /> </div> <p><br><input type="button" value="Toggle Rnsit" onclick = "flipImag()" /></p> </form> </body> </html> //showHide.js function flipImag() { if(dom.visibility == "visible") dom.visibility = "hidden"; else dom.visibility = "visible"; } 6. With an example of XHTML doc with java script, explain dynamic content (10 Marks) (July-2014). Solution: DYNAMIC CONTENT We now develop an example that illustrates one use of dynamic content. Assistance to a browser user filling out a form can be provided with an associated text area, often called a help box. The content of the help box can change, depending on the placement of the mouse cursor. When the cursor is placed over a particular input field, the help box can display advice on how the field is to be filled in. When the cursor is moved away from an input field, the help box content can be changed to simply indicate that assistance is available. In the next example, an array of messages that can be displayed in the help box is defined in JavaScript. When the mouse cursor is placed over an input field, the mouseover event is used to call a handler function that changes the help box content to the appropriate value The appropriate value is specified with a parameter sent to the handler function. The mouseout event is used to trigger the change of the content of the help box back to the “standard” value. //dynValue.html <html> <head> <title>Dynamic Values</title> <script type = "text/javascript" src = "dynValue.js"> </script>