Help - Search - Members - Calendar
Full Version: Webpage help...
HTMLHelp Forums > Programming > Client-side Scripting
Xthlon
hello all,

this is a 100% muck-around page that is not going to be put online.... biggrin.gif

just for general knowledge sakes... why doesnt this script work? sad.gif

CODE
<html>

<HEAD>
<script language="JavaScript">
function text()
{
setTimeout(1000);
document.write("<h1 style='text-align: center'><a href='http://download.imgburn.com/SetupImgBurn_2.5.0.0.exe'></a></h1>");
}
</SCRIPT>
</HEAD>

<BODY>

<h2 style="text-align: center">Redirecting to external mirror...</h2>
<h3 style="text-align: center">Downloading...</h3>
<div onload="text()"></div>

</body>

</html>


I want it to load up with the text "Redirecting to external mirror..." and "Downloading..." and then I want it to wait 1 second and then display "http://download.imgburn.com/SetupImgBurn_2.5.0.0.exe" as a link...(ImgBurn is just an example im using.......!!)

Im guessing ive totally stuffed the div element and its probs not even neccessary tongue.gif



thanks for future help,

--
Xthlon
Christian J
QUOTE
setTimeout(1000);

The timer lacks a function call. Try calling text() from the timer.

QUOTE
document.write("<h1 style='text-align: center'><a href='http://download.imgburn.com/SetupImgBurn_2.5.0.0.exe'></a></h1>");

You can't insert an H1 element into the HEAD section of a page, put it into BODY or other valid parent element.

Also, using document.write() after the page has loaded will overwrite the existing content. Instead, try using innerHTML on some existing parent element.

QUOTE
<div onload="text()"></div>

DIV elements don't support the onload event. You might simply call the function from a script at the end of the page, or from an onload in the BODY start tag.
Xthlon
thanks

I'll fix it up and let you know if I have any problems biggrin.gif
This is a "lo-fi" version of our main content. To view the full version with more information, formatting and images, please click here.
Invision Power Board © 2001-2014 Invision Power Services, Inc.