Heres some example of basic working jscript on the WRT platform.
Jscript popup
<!DOCTYPE html> <html> <head> <script type="text/javascript"> function myFunction() { alert("TEXT TO DISPLAY ")}</script> </head> <body> <input type="button" onclick="myFunction()" value="NAME OF BUTTON TO ACTIVATE COMMAND" /> </body>
</html>/
Confirm box
<!DOCTYPE html>
<html>
<body>
<p>Click the button to display a confirm box.</p>
<button onclick="myFunction()">BUTTON TEXT</button>
<p id="demo"></p>
<script type="text/javascript">
function myFunction()
{
var x;
var r=confirm("Confirm box info text");
if (r==true)
{
x="You pressed Yes!";
}
else
{
x="You pressed No!";
}
document.getElementById("demo").innerHTML=x;
}
</script>
</body>
</html>
Display the current year
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to display the full year of todays date.</p>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction()
{
var d = new Date();
var x = document.getElementById("demo");
x.innerHTML=d.getFullYear();
}
</script>
</body>
</html>
Display the current day
<!DOCTYPE html>
<html>
<body>
<p id="demo">Click the button to display todays day of the week.</p>
<button onclick="myFunction()">Try it</button>
<script type="text/javascript">
function myFunction()
{
var d = new Date();
var weekday=new Array(7);
weekday[0]="Sunday";
weekday[1]="Monday";
weekday[2]="Tuesday";
weekday[3]="Wednesday";
weekday[4]="Thursday";
weekday[5]="Friday";
weekday[6]="Saturday";
var x = document.getElementById("demo");
x.innerHTML=weekday[d.getDay()];
}
</script>
</body>
</html>
Display the time
<!DOCTYPE html>
<html>
<head>
<script type="text/javascript">
function startTime()
{
var today=new Date();
var h=today.getHours();
var m=today.getMinutes();
var s=today.getSeconds();
// add a zero in front of numbers<10
m=checkTime(m);
s=checkTime(s);
document.getElementById('txt').innerHTML=h+":"+m+":"+s;
t=setTimeout('startTime()',500);
}
function checkTime(i)
{
if (i<10)
{
i="0" + i;
}
return i;
}
</script>
</head>
<body onload="startTime()">
<div id="txt"></div>
</body>
</html>