Friday, July 31, 2009

Timeout in JavaScript -- Sample

{head>

{script language="JavaScript1.2">

//configure flash (1000=1 second)
var speed=500

function flashit(){
var crosstable=document.getElementById? document.getElementById("spaexample") : document.all? document.all.spaexample : ""
if (crosstable){
if (crosstable.style.borderColor.indexOf("green")!=-1)//Start configure border colors//
crosstable.style.borderColor="red"
else
crosstable.style.borderColor="green" //End configure border colors//
}


//document.all.textcolumn.value=speed
mainform.textcolumn.value=speed



if (speed { 510)
{
speed++
setTimeout("flashit()",1000);
}

}


//setInterval("flashit()", speed)


{/script>
{/head>
{body>

{form name=mainform>

{table border="0" width="280" id="spaexample" style="border:5px solid green">
{tr>
{td>
Insert anything you want into this table.
{br>Insert anything you want into this table.
{br>Insert anything you want into this table.{br>{/td>
{/tr>
{/table>

{input type="text" name=textcolumn id="textcolumn" value=initvalue >

{script language="JavaScript1.2"> flashit() {/script>

{/form>
{/body>

No comments: