Q1. Write a java script
program to accept a number form user and calculate and display its sum of
digits
<HTML><body>
<script>
function
sum()
{
var
sum=0;
var
no=parseInt(frm.txt1.value);
while(no>0)
{
sum=sum+no%10;
no=Math.floor(no/10);
}
alert("Sum
of digits "+sum);
}
</script>
<form
name="frm">
Enter
a Number:<input name="txt1" type="text" />
<input
name="b1" onclick="sum();" type="button"
value="display" /></form>
</BODY>
</HTML>
Q2. Write HTML code to
design a web as per given specification. Divide the browser screen into two
frames. The first frame will display the heading. Divide the second frame into
two columns. The frame on the left should be name of cities consisting of
hyperlinks. Clicking on any one of these hyperlinks will display related
information in right hand side frame as shown below
frames.html
<html>
<frameset
rows="30%,*">
<frame
src="header.html" name="frame1">
<frameset
cols="30%,*">
<frame
src="links.html" name="frame2">
<frame
src="pune.html" name="frame3">
</frameset>
</frameset>
</html>
header.html
<html>
<body><h1
align="center"><font color="red">IT Industries in
India</FONT></H1></BODY>
</HTML>
links.html
<html><head><title>
Frame Example </title></head>
<body><b>City</b><br>
<ol
type="1">
<li><a
href="pune.html"
target="frame3">pune</A></li><br>
<li><a
href="b.html"
target="frame3">banglore</A></li><br>
</ol>
</body>
</html>
pune.html
<html><body><h3>Pune</h3>
<ul
type="disc"><li>Infosys</li><li>Persistent</li></ul>
</body>
</html>
b.html
<html><body><h3>Mumbai</h3>
<ul
type="disc"><li>
---</li><li>---</li><li>----</li><li>----</li></ul>
</body>
</html>