Professional Documents
Culture Documents
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>hyperlinks depicted</title>
</head>
<body>
<a href="list_graphic_bullets.htm">Link to list_graphic_bullets.htm</a><br>
<a href="https://www.amazon.com/">Link to an Amazon.com</a><br>
<img src="images/book1.gif" alt="book" style="width:48px;height:48px;">
<p>He we are at our jump...</p>
<a href="back to top">back to top</a><br>
<p>A</p>
<p>B</p>
<p>C</p>
<p>D</p>
</body>
</html>
2.Create a page that looks like the one depicted below.
<html lang="en">
<head>
<meta charset="UTF-8">
<meta http-equiv="X-UA-Compatible" content="IE=edge">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<title>One depicted</title>
</head>
<body>
<ol>
<li>One
<li>Uno</li>
<li>hanna</li>
</ol>
</li>
<li>Two
<ol type = "a">
<li>dos</li>
<li>dool</li>
</ol>
</li>
<li>Three
<ol type = "a">
<li>tres</li>
<li>set</li>
</ol>
</li>
<ul>
<li>Cherry
<ul>
<li>Cavalier</li>
<li>Malibu</li>
</ul>
</li>
<li>Ford
<ul>
<li>Escort</li>
<li>F100</li>
</ul>
</li>
<li>Marda
<ul>
<li>626</li>
</ul>
</li>
</ul>
<ul>
<l><u>Fruits</u></l>
<ul>Apples,Oranges,Pears,Plums </ul>
<l><u>Vegetables</u></l>
<ul>
<ol>Corn</ol>
<ul style="list-style-type:Italic;">
<ol>on the cob</ol>
<ol>Cream</ol>
</ul>
</li>
<ol>Carrots</ol>
<ol>Green Beans</ol>
</ul>
</li>
</ul>
</body>
</html>
3.Create a form that includes 2 textboxes (one for name, one for email address), a
Textarea, a dropdown box (<select> tag), a set of radio buttons, and a set of
Checkboxes. Format the form using a table. Use the GET method for form submit.
Add JavaScript event handlers to the form to validate the form before it is Submitted.
If the validation fails, display the problem details as a pop-up box by displaying the
problems in a new window in red text and having the user use the back button to go
back to the original page displaying the problems in the current window at the top of
the page in red text
<html lang="en"><head>
meta charset="utf-8">
<meta name="keywords" content="example, JavaScript Form Validation, Sample registration form" />
<script src="sample-registration-form-validation.js"></script>
</head>
<body onload="document.registration.userid.focus();">
<h1>Registration Form</h1>
Use tab keys to move from one input field to the next.
<form name='registration' onSubmit="return formValidation();">
<ul>
</ul>
</form>
</body>
</html>
4a)Use a pop-up box to take info from user to replace all ‘a’ in a sentence to ‘x’
Sol:- const string = 'Mr raja has a orange hat and a red car';
const regex = /a/gi;
const newText = string.replace(regex, 'x');
console.log(newText);
4b)Create a variable age, and set it to 17. Now create a conditional statement that
displays the message “You are too young”, if the value of age is less than 18. If the
value is 18 or more, display the message “You may enter”. Change the value of age to
test that the statement works as specified
<html lang="en">
<head>
<script>
function validate(age){
var ans="your are too young";
if(age>=18){
ans="you may enter";
}
return(ans);
}
</script>
</head>
<body>
<script>
var age=parseInt(prompt("Enter age"));
var status=validate(age);
document.write("You are <b>"+status+"</b> for age");
</script>
</body>
</html>
5.Create a page with JavaScript to do the following. These can all be on one page.
1. Prompt the user for their name.
2. Use a pop-up box to welcome the user by name.
<html>
<head>
<title>Javascript Prompt Box example</title>
</head>
<body>
<script type="text/javascript">
name = prompt("What is your name ? ")
if(name != null && name != "")
alert("Welcome : "+name);
else
alert("Welcome Unknown!!")
</script>
</body>
</html>
3. Display the current date on the page in the following format: October 30, 2000. Do
not display the time. Do not "hard code" the date; if I load the page tomorrow, I
should get a different date than if I load it today.
Sol:- <html>
<body>
<script>
var date = document.lastModified;
document.write("Last Modified: "+date);
</script>
</body>
</html>
5. Display a message saying Good Morning if the time is before 12:00, Good
Afternoon if the time is between 12:00 and 18:00 and Good Evening otherwise.
Sol:-<html>
<head>
<title> Message using JavaScript</title>
</head>
<body>
<label id="lblMassage"></label>
</body>
<script>
var myDate = new Date();
var hrs = myDate.getHours();
var greet;
document.getElementById('lblMassage').innerHTML =
'<b>' + greet + '</b> !';
</script>
</html>