Monday, September 28, 2009

Basic Javascript in web

Window popup

<head>
<script type="text/javascript">
<!--
function myPopup() {
window.open( "http://www.google.com/" )
}
//-->
</script>
</head>
<body>
<form>
<input type="button" onClick="myPopup()" value="POP!">
</form>
<p onClick="myPopup()">CLICK ME TOO!</p>
</body>


Alert box

<form>
<input type="button" onclick=
"alert('Are you like the greatest post?')"
value="Confirmation Alert">
</form>


Page redirect

<html>
<head>
<script type="text/javascript">
<!--
function delayer(){
window.location = "../javascriptredirect.php"
}
//-->
</script>
</head>
<body onLoad="setTimeout('delayer()', 5000)">
<h2>Prepare to be redirected!</h2>
<p>This page is a time delay redirect, have fun with the greatset post</p>

</body>
</html>


for more... wait for update soon..

No comments: