This is the code I have so far, but something seems to be wrong with it. I don't know what though. Could someone point out what I'm doing wrong?

<HTML>
<HEAD>
     <TITLE>Fun with Phonics</TITLE>

</HEAD>
<BODY>
<CENTER><IMG SRC="fun.jpg" HSPACE=5 VSPACE=5 HEIGHT=64 WIDTH=129></CENTER>

<CENTER><HR Width="75%"></CENTER>
<SCRIPT LANGUAGE="JAVASCRIPT">
<!--Hide from old browswers
	document.bgColor="red"
	document.bgColor="white"
	document.bgColor="blue"
	document.bgColor="white"
	document.bgColor="green"
	document.bgColor="white"
	document.bgColor="blanchedalmond"
	var tNow = new Date()
	var tlocDate = tNow.toLocaleString()
	var tDate = tlocDate.substring(0,10)
	document.write("H2><CENTER>Welcome, today is "+tDate+"</CENTER></H2>")
	var intro1 = "Hi, thanks for visiting our Web site, but we have moded. Please make a note "
	var intro2 = "of our new URL (www.funwithphonics.com) and notify the Webmaster about our new "
	var intro3 = "location. Click<A Href='http://www.scsite.com/'> here </A> or wait 15 second "
	var intro4 = "to be moved automatically to our new site."
	var introMsg = intro1+intro2+intro3+intro4
	document.write("<H4><FONT Color='firebrick'>"+introMsg+"</H4></FONT">


//-->
</SCRIPT>

</BODY>
</HTML>

Recommended Answers

All 8 Replies

document.write("<H4><FONT Color='firebrick'>"+introMsg+"</H4></FONT">

One thing that jumps out in the code presented is the above needs to have a closing ")".And also you are closing your string in the above inside the </FONT> tag.
Should be:

document.write("<H4><FONT Color='firebrick'>"+introMsg+"</H4></FONT>");

Try debugging in Firefox with Firebug or if you are using IE8 hit f12 and use the developer tools. The error messages will be cryptic but it will give you a general idea of where the problem lies.

It seems that something else is wrong or missing..It's still not working correctly

document.write("H2><CENTER>Welcome, today is "+tDate+"</CENTER></H2>")

The above should be:

document.write("<H2><CENTER>Welcome, today is "+tDate+"</CENTER></H2>")

Every tag needs to have an opening < and a closing > and every <tag> set needs to end with the corresponding </tag> set. For example if you have a <p> you need to end with </p>.

Isn't that the same as I already have it?

You are missing the "<" in front of the h2 in the code you provided.

Opps. Didn't catch that..but it's still not working :S

you have typed > instead of ) at the end of line no 28 of your code, remove > and type )

document.write("<H4><FONT Color='firebrick'>"+introMsg+"</H4></FONT" )

Hi,
Your code looks fine, all it needs is a little arrangement in the order of the tags last posted by urtrivedi and including changes made by scrappedcola. Might as well give it a try and see if i can fit your needs...

<HTML>
<HEAD>
     <TITLE>Fun with Phonics</TITLE>

</HEAD>
<BODY>
<CENTER><IMG SRC="fun.jpg" HSPACE=5 VSPACE=5 HEIGHT=64 WIDTH=129></CENTER>

<CENTER><HR Width="75%"></CENTER>
<SCRIPT TYPE="text/javascript">
<!--Hide from old browswers
	var randomBG = [ "red", "white", "blue", "green", "blanchedalmond" ];
	var day = [ "Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday" ];
	document.bgColor = randomBG[ Math.floor( Math.random() * randomBG.length ) ];
	var tNow = new Date();
	document.write("<H2><CENTER>Welcome, today is " + day[ tNow.getDay() ] + "</CENTER></H2>");

		var introMsg = "Hi, thanks for visiting our Web site, but we have moded. Please make a note ";

	introMsg += "of our new URL (www.funwithphonics.com) and notify the Webmaster about our new ";
	introMsg += "location. Click<A Href='http://www.scsite.com/'> here </A> or wait 15 second ";
	introMsg += "to be moved automatically to our new site.";

	document.write("<H4><SPAN STYLE=\"color:firebrick;\">" + introMsg + "</SPAN></H4>");


//-->
</SCRIPT>

</BODY>
</HTML>

essential

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.