0% found this document useful (0 votes)
8 views

girishexp_7_WT (1)

Uploaded by

Nimish chandna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
8 views

girishexp_7_WT (1)

Uploaded by

Nimish chandna
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Experiment-7

Aim:Using JavaScript Snippet which makes use of java script inbuilt as well as user defined
objects like navigator ,date array, Event and data types.

Code:
<!DOCTYPE html>
<htmL>
<head>
<title>Exp_7 </title>
<script LANGUAGE="JavaScript">
functiongetdate(){
var now = new Date();
var days = new Array('Sunday','Monday','Tuesday','Wednesday','Thursday','Friday','Saturday');
var months =
newArray('January','February','March','April','May','June','July','August','September','October','No
vember','December');
var date = ((now.getDate()<10) ? "0" : "")+ now.getDate();
functionfourdigits(number) {
return (number < 1000) ? number + 1900 : number;
}
today = days[now.getDay()] + ", " +
months[now.getMonth()] + " " +
date + ", " +
(fourdigits(now.getYear())) ;
document.getElementById('dt').innerHTML = today;
}
</script>
</head>
<body>
<h3 id="cdnm"></h3><br /><br /><br />
UID-15BCS1930
Group-1
<script>
document.getElementById('cdnm').innerHTML= "Code Name: " +navigator.appCodeName
+"<br />"+
"App Name: " +navigator.appName + "<br />" +
"App Version: " +navigator.appVersion + "<br />" +
"GeoLocation: " +navigator.geolocation + "<br />" +
"Language: " +navigator.language + "<br />" +
"Product: " +navigator.product + "<br />" +
"Online: " +navigator.online + "<br />" +
"Cookie Enabled: " +navigator.cookieEnabled + "<br />" +
"User Agent: " +navigator.userAgent + "<br />" +
"Platform: " +navigator.platform + "<br />" ;
</script>
<h3 id="dt" ></h3>
<button
onclick='getdate()'>The time is?</button>
<h3 id="evt" onclick='myfunc()' >Event Listner<h3>
<script>
functionmyfunc(){
document.getElementById('evt').innerHTML="You had Clicked an Html Element";
}
</script>
<h3 id="dtype"><h3>
<script>
var a = true;
var b = 5;
var c = 10.4;

UID-15BCS1930
Group-1
var d = "Hey";
document.getElementById('dtype').innerHTML =
"Boolean: " + a + "<br />" +
"Integer: " + b + "<br />" +
"Float: " + c + "<br />" +
"String: " + d + "<br />" ;
</script>
</body>
</html>

Output:

UID-15BCS1930
Group-1

You might also like