- Lab 1 : A script that checks if it is a workday (Monday to
Friday) or a weekend (Saturday and Sunday)
- Todays date:
-
Source:
Todays date:
<script language="javascript" type="text/javascript">
<!--
/* writes out the date and if it is a workday or not */
iDatum = new Date()
iDag = (iDatum.getDay())
iDat = (iDatum.getDate())
x = 0
iMonth = (iDatum.getMonth())
document.write(iMonth + 1, "/", iDat)
document.write("<DD>")
if (iDag == 0){
x = 0
}
if (iDag == 6){
x = 6
}
else {iDag + 1}{
x != iDag
}
if (iDag != x ) {
document.write("<i>Workday Oh no!</i> ")
}
else {document.write("<b>Weekend yes!</b>")
}
//-->
</script>
- Lab 2 : This script takes the modulus of 3 and 2 and adds 10.
-
-
Source:
<b>
<script language="javascript" type="text/javascript">
<!--
a = 2
b = 3
c = 10
document.write(b, " modulus ", a, " plus ", c, " equals", b % a + c)
//-->
</script>
</b>
- Lab 3 : A script that writes my name 10 times.
-
-
Source:
<script language="javascript" type="text/javascript">
<!--
/* I put i to 1. i writes out the number of the loop and makes a row in the list and it is written out 10 times, as is my name. */
for (i=1; i<=10; i++){
document.write("</dd><dd>")
document.write(i)
document.write(". Jan Nylund ")
}
//-->
</script>
- Lab 4 : A JavaScript that write out "Saturday" on Saturday or
"No Saturday today" if it is not.
-
-
Source:
<script language="javascript" type="text/javascript">
<!--
iDag = new Date()
iDag = (iDag.getDay())
if (iDag == 6 ) {
document.write("<h1>Saturday<\/h1>")
}
else {
document.write("<strong>No Saturday today.<strong>")
}
//-->
</script>