First let me introduce myself as Miss Beginner of all time!...I recently took upon myself to give myself a challenge and take a beginner's javascript course...in my first assignment i have to display certain scripts...i have accomplished everything so far except on my second page i would like to have the "daysTill()" to display where i wrote the text in my document...i would be so ever grateful if someone could help me out....here is my complete 2 pages of scripts and i have bolded and change the color of where i mean exactly:
<script type="text/javascript">
<!--
picList = new Array("images/topban1.png","images/topban2.png","images/topban3.png","images/topban4.png","images/topban5.png","images/topban6.png","images/topban7.png");
document.myrotate ="images/background_top.jpg"
thisImg = 0
imgCount = picList.length=7
function rotate() {
if (document.myrotate) {
thisImg++
if (thisImg == imgCount) {
thisImg = 0
}
document.bannerImg.src=picList[thisImg]
setTimeout("rotate()", 3 * 1000);
}
}
function daysTill() {
var day = 29
var month = 03
var year = 2011
var end = " days left before the end of the Javascript course?"
var daystocount = new Date(year, month -1, day)
today=new Date()
if (today.getMonth()==month && today.getDate()>day)
daystocount.setFullYear(daystocount.getFullYear())
var oneday=1000*60*60*24
var write = (Math.ceil((daystocount.getTime()-today.getTime())/(oneday)))
document.write("<h2>" + "There are <strong>" + write + "</strong>" + end +" "+ "</h2>");
}
-->
</script>
<style type="text/css">
body {
background-color: #000;
}
#content {
background: url(images/bkgd.jpg) repeat;
width: 800px;
padding: 0px;
margin: 0px auto;
font-size: 18px;
}
#content p noscript em {
font-size: 14px;
}
#footer {
background: #333;
width: 800px;
margin-right: auto;
margin-left: auto;
font-size: 16px;
font-style: italic;
color: #E8B870;
text-align: center;
}
#content p {
text-align: left;
padding: 8px;
}
#content h4 {
text-align: right;
margin-right: 20px;
}
#content table {
text-align: center;
}
h5 {
margin-left:20px;
}
h2 {
margin-left:25px;
font-size: 20px;
font-style:italic;
font-weight:normal;
}
</style>
</head>
<body onLoad="rotate(),daysTill()">
<div id="content">
<h4><img src="images/topban1.png" name="bannerImg" width="800" height="90" />by Martine Couture</h4>
<p><noscript><em>This page requires Javascript</em></noscript></p>
<script type="text/javascript">
<!--
RightNow = new Date();
hour = RightNow.getHours();
minutes = RightNow.getMinutes(01);
if (minutes < 10){
minutes = "0" + minutes
}
document.write("<h5>" + "Current time is: " + hour + ":" + minutes + "</h5>");
var i=48;
do {
document.write("<h2>" + "Yes I am " +i,(", years old...and who would of have thought I would take on Javascript!" + "</h2>"));
document.write("<br />");
i++
}
while (i<=1);
var answer;
while (answer!=48) {
answer = prompt("Guess my age...careful! ","");
switch (answer) {
case "40":
alert("I wish!");
break;
case "41":
alert("Not even close!");
break;
case "43":
alert("Keep going up!");
break;
case "44":
alert("Half way there!");
break;
case "45":
alert("Keep going...");
break;
case "46":
alert("Getting close!");
break;
case "47":
alert("You are so very close!");
break;
case "48":
alert("Yep you guessed it right!");
break;
case "49":
alert("That's not nice!");
default:
alert("Play fair!");
}
}
function newWindow(img) {
thisWindow = window.open(img, "newWin", "width=400,height=300,top=400,left=480");
thisWindow.focus();
}
-->
</script>
[COLOR="Red"][B]<p>Did you know there are...days left before the end of the Javascript course?</p>[/B]<[/COLOR]p><span style="cursor:pointer"></span>Did my page meet all expected Javascript? </p>
<p style="cursor:pointer" onclick="window.status='Right on! I may someday learn to love it!';return true">Yes!
<p style="cursor:pointer" onclick="window.status='Darn! Please tell me what I am missing?';return true">Almost!</p>
<p><center></center></p>
</div>
<div id="footer">Hoping you enjoyed my last assignment...javascript is a struggle!</div>
<p> </p>