PDA

Click to See Complete Forum and Search --> : Syntax Error in my code. Help !


Mark Sreeves
Jun 28th, 2000, 03:08 AM
next please!


<HTML>
<HEAD>
<TITLE>Timer Function Example</TITLE>

<script langauge="JavaScript"> <!-- hide me
function alertIn2Secs()
{

the_timeout = setTimeout("document.writeln('Hello');", 2000);

}

// show me -->

</script>

</HEAD>

<BODY OnLoad="alertIn2Secs()">

</BODY>
</HTML>

nmretd
Jun 28th, 2000, 04:38 PM
Thanks mark,

can you tell me is it possible to do the following or is my syntax incorrect again ?

<HTML>
<HEAD>
<TITLE>Timer Function Example</TITLE>

<script langauge="JavaScript">

<!-- hide me

var string1 = Hello"
var string2 = "World"

function alert1()

{
the_timeout = setTimeout("document.writeln(string1)", 1000); ("document.writeln(string2)", 2000);
}

// show me -->

</script>


</HEAD>


<BODY OnLoad="alert1()">

</BODY>
</HTML>

nmretd

Mark Sreeves
Jun 28th, 2000, 06:17 PM
the document.write() function overwrites what is already there

you can use alert()s though

<HTML>
<HEAD>
<TITLE>Timer Function Example</TITLE>

<script langauge="JavaScript">
<!-- hide me
var string1 = "Hello";
var string2 = "World";

function alert1()
{
setTimeout("alert(string1)", 1000);
setTimeout("alert(string2)", 2000);
}
// show me -->
</script>

</HEAD>
<BODY onload="alert1()">




</BODY>
</HTML>