Download as pdf or txt
Download as pdf or txt
You are on page 1of 2

function f(){alert(window.document.f1.t1.

value)}
JAVASCRIPT </script><body>
TUTORIAL <FORM name="f1">email<input type="text"
value="" name="t1">
WRITE THE SCRIPT FOR THE FOLLOWING <INPUT TYPE="button" name="n1"
value="click me" onclick="f()">
1.TO RETURN THE NO OF IMAGES OF </FORM></body></html>
THE DOCUMENT 7.Click a button change the color of button
<html><head><script> <html><head><script>
function f() function f()
{document.write("length " + {window.document.f1.b1.style.backgroundColor
document.images.length)} = "blue"}
</script><body> </script><body><b>click to button to change the
<img src="" height=100 width=100> color of the text</b>
<img src="" height=100 width=100> <FORM name="f1">
<img src="" height=100 width=100> <INPUT TYPE="button" name="b1"
<input type="button" onclick="f()"> value="click me" onclick="f()">
</body></html> </FORM></body></html>
2.TO RETURN THE DATE AND TIME OF 8.To fetch multiple value of a list box
THE DOCUMENT LAST MODIFIED <html><head><script>
<html><head><script> function f1()
function f() {a=window.document.f.menu.options.length
{document.write("lastModified"+document.last for (i=0;i<a ;i++)
Modified)} {if
f();</script><body><br><b>hai </b><b>bye (window.document.f.menu.options[i].selected)
</b></body></html> {alert(window.document.f.menu.options[i].value)
3.TO RETURN FULL URL OF THE }}}
DOCUMENT </script><body>
<html><head><script> <form name="f">
function f() <select name="menu" multiple>
{document.write("URL : : :"+document.URL)} <option value="a">a
f();</script> <option value="b">b
<body>TO GET THE FULL URL <option value="c">c
</body></html> <option value="d">d
4.Set the button to disabled when clicked </select>
<html><head><script> <input type="button" name="a2" value=""
function f() onclick="f1()" >
{ window.document.f1.n1.disabled=true} </form></body></html>
</script><body> 9.Script to give a message on resize of a
<FORM name="f1"> window
<INPUT TYPE="button" name="n1" <html><head><script>
value="disable" onclick="f()"> function f()
</FORM></body></html> {document.write("u have resized")}
5.To return the number of form elements . </script><body onresize="f()">
<script>function f(){document.write resizing</body></html>
(window.document.f1.length)}</script> 10.Change the text of a selected index
6.To return the value of a text area box 11.Change CURRENT DATE
<html><head><script>
12On focusing textbox1 change the content of
textbox2

13.To create 3 history pages and access 2 page


Z.HISTORY.GO(2)
14.Use mouse down event to enlarge an image.
<html><head></head>
<script language="javascript">
function f()
{window.document.getElementById("aa").height
=300
window.document.getElementById("aa").width=
300}
</script><body>
<img src ="jim.graham.gif" height ="100" width
="50" id="aa"
onmousedown='f()'></body></html>

15To replace the string =”hello welcome to my


home” to hai welcome to my home
document.write(string.replace("hello",
"hai")+"<br>")
16 onclick of a button change the image of a
button
17 randomly print three images use setinterval

You might also like