With an example of XHTML doc with java script explain dynamic content

The Eduladder is a community of students, teachers, and programmers just interested to make you pass any exams. So we solve previous year question papers for you.
See Our team
Wondering how we keep quality?
Got unsolved questions?

Ask Questions
PROGRAMMING-THE-WEB-10CS73-->View question


With an example of XHTML doc with java script explain dynamic content

Asked (10 Marks) (July-2014). 

By:Rajiv

Taged users:


Likes:
Be first to like this question

Dislikes:
Be first to dislike this question

Talk about thisDelete|Like|Dislike|


Answers

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>

</head>

<body>

<form action="">

<p style = "font-weight: bold">

<span style = "font-style: italic"> Customer Information </span>

<br>

<label>Name: <input type="text" onmouseover="messages(0)" onmouseout="messages(4)" /> </label>

<br>

<label>Email: <input type="text" onmouseover="messages(1)" onmouseout="messages(4)" /> </label>

<br><br><br>

<span style = "font-style:italic"> To create an account, provide the following information: </span>

<br><br>

<label>User ID: <input type="text" onmouseover="messages(2)" onmouseout="messages(4)" /> </label>

<br> <label>Password: <input type="text" onmouseover="messages(3)" onmouseout="messages(4)" />

</label>

<br>

<textarea id="adviceBox" rows="3" cols="50" style="position:absolute; left:250px; top:0px"> This box provides advice on filling out the form on this page. Put the mouse cursor over any input field to get advice. </textarea> <br><br> <input type="submit" value="Submit" />

<input type="reset" value="Reset" />

</p>

</form>

</body>

</html>

//dynValue.js

var helpers = ["Your name must be in the form: \n first name, middle initial., last name", "Your email address must have the form: \ user@domain", "Your user ID must have at least six characters and it must include one digit", "This box provides advice on filling out the form on this page. Put the mouse cursor over any input field to get advice"] function messages(adviceNumber) { document.getElementById("adviceBox").value=helpers[adviceNumber]; }


neenu2

Likes:
Be first to like this answer

Dislikes:
Be first to dislike this answer
Talk about this|Once you have earned teacher badge you can edit this questionDelete|Like|Dislike|
------------------------------------

Can you help us to add better answer here? Please see this



Not the answer you're looking for? Browse other questions from this Question paper or ask your own question.

Join eduladder!