Lesson3 Excecise Solution1
Lesson3 Excecise Solution1
Lesson3 Excecise Solution1
Shilpa Kate
4. The closed property returns a Boolean value indicating whether a window has been
closed or not.
5. Onblur event occurs when AN element looses its focus.
ANS: FALSE
3. GETDAY() method of DATE object returns month in number.
ANS: FALSE
4. onKeydown event occurs when user moves mouse pointer.
ANS: FALSE
document.write(str. LASTINDEXOF("O"); A) 18 b) 19
c) 20 d) 21
a) URL b) title
c) NAME D)STATUS
3. ---------- AND ----------- ARE event HANDLER used with text object
in JAVASCRIPT.
A) onBlur b) onMove
e) onFocus d) onAction
a) Time b) DATE
c) INHERITANCE d) ARRAY
e) Number f) function
Q.6 ExplAIN the following.
1. WHAT ARE similARITIES AND differences between client side scripting
AND server side scripting.
<html>
<script type="text/javascript">
var result=0;
function calc()
var n1=parseInt(f1.t1.value);
var n2=parseInt(f1.t2.value);
result=n1+n2;
document.write("<br>Addition is="+result);
result=n1*n2;
document.write("<br>Multiplication is="+result);
result=n1/n2;
result=n1%n2;
document.write("<br>Reminder is="+result);
</script>
</head>
<body>
<form name="f1">
</form>
</body>
</html>
<HTML>
<script type="text/javascript">
function fact()
i=1,fact=1;
for(i=1;i<=num;i++)
fact=fact*i;
document.write("factorial of "+num+"="+fact);
</script>
</Head>
<body>
<form name="f1">
</form>
</body>
</HTML>
4. Accept ANY string from user AND count AND DISPLAY number of
vowels occurs in it.
Ans:
<html>
<head>
<title>find number of vowels in a string in JavaScript</title>
<script type="text/javascript">
function Vowels()
{
var str = document.getElementById("t1").value;
var count = 0, total_vowels="";
for (var i = 0; i < str.length; i++)
{
// findVowels
if(str.charAt(i)=="a"||str.charAt(i)=="e"||str.charAt(i)=="i"||str.charAt(i)=="o"||str.ch
arAt(i)=="u"||str.charAt(i)=="A"||str.charAt(i)=="E"||str.charAt(i)=="I"||str.charAt(i)
=="O"||str.charAt(i)=="U")
{
count++;
}
}