csspr
csspr
Aim :- Write Simple javascript with HTML for arithmetic expression evaluation and
message printing.
Program :-
Arithmetic Operations:
<html>
<head>
<title> Arithmatic Operation </title>
<script>
var ch = parseInt(prompt("Hello!! Please Select One Of The Operation You Want To
Choose 1.Addition 2.Subtraction 3.multiplication 4.Division" ));
var a = parseInt(prompt("Enter First number"));
var b = parseInt(prompt("Enter Second number"));
switch(ch)
{
case 1:
document.write("Addition of " +a+ " and " +b+ " is " +(a+b));
break;
case 2:
document.write("Subtraction of " +a+ " and " +b+ " is " +(a-b));
break;
case 3:
document.write("Multiplication of " +a+ " and " +b+ " is " +(a*b));
break;
case 4:
document.write("Division of " +a+ " and " +b+ " is " +(a/b));
break;
default:
document.write("Invalid Number");
}
</script>
</head>
</html>
Output :-
Conclusion :-
Program :−
<html >
<head>
<title>Sports Information Form</title>
</head>
<body>
<h1>Sports Information Form</h1>
<form name = Sports>
Player Name:
<input type="text" id="player-name" name="player-name"><br><br>
Select Sport:
<select id="sport" name="sport">
<option value="soccer">Soccer</option>
<option value="basketball">Basketball</option>
<option value="tennis">Tennis</option>
<option value="cricket">Cricket</option>
<option value="baseball">Baseball</option>
</select><br><br>
Skill Level:<br>
<input type="radio" id="beginner" name="skill-level" value="beginner">beginner
<br>
<input type="radio" id="intermediate" name="skill-level"
value="intermediate">intermediate<br>
<input type="radio" id="advanced" name="skill-level"
value="advanced">advanced<br><br>
Conclusion :-
Program :−
<html>
<body>
<form action="">
Full Name:
Password:
<input type="reset"><br><br>
Gender:
Preferred Course:<br>
</form>
</body>
</html>
Output :-
Conclusion :-
In this practical I have successfully implement the Form elements .
Program :−
<html>
<body>
Full Name:
onfocus="this.style.backgroundColor='lightyellow';"
onblur="this.style.backgroundColor='';"
onselect="alert('Text selected!');"><br><br>
Password:
onfocus="this.style.backgroundColor='lightyellow';"
onblur="this.style.backgroundColor='';"><br><br>
Gender:
Preferred Course:<br>
</form>
<script>
function displayInfo() {
courseCheckboxes.forEach(checkbox => {
courses.push(checkbox.value);
});
alert("Student Information:\n\n" +
</script>
</body>
</html>
Output :-
Conclusion :-