Create an HTML document, Add two button and one image elements to your document.
ID: 669116 • Letter: C
Question
Create an HTML document,
Add two button and one image elements to your document.
Prepare two pictures. When you open your document, the first picture will be displayed. When you click the first button, the second picture will be displayed. Use this button to toggle the img src between these two pictures.
When you click the second button, an alert window will pop up and show this message “Hello, my name is YourFullName!”
At the end of your document inside the body element, add an input textbox and a button, . Your script element should (a) prompt the user for the radius of a sphere, (b) calculate the volume of the sphere, and (c) display the radius and volume. Use the statement
volume = ( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3);
to calculate the volume.
Explanation / Answer
<html>
<head>
<script language = "Javascript">
var r=inputbox("Enter Radius");
var v=0,r1=0;
</script>
</head>
<body>
<a id ="button" title="button">
onMouseClick=document.a1.src="a.gif">
<img src="a.gif" name="a1">
</body>
<a id = "button1" title="button-clk" my name is YourFullName")>
<script language="Javascript">
r1=eval(r);
v=( 4.0 / 3.0 ) * Math.PI * Math.pow( radius, 3);
document.write("Radius is " + r1);
document.write("Volume of spere is" + v);
</script>
</html>
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.