Java Script

Posted On February 23, 2010

Filed under web application

Comments Dropped leave a response

Redirect a page using confirm :

<script type=”text/Javascript”>
var url=”;;
var redirect=confirm(“Do you want to be redirected to “+url);

Alert – “On Click”

You can place the JavaScript alert() function directly into a button element, then use the ‘onclick’ event to trigger it. Like this:

<input type=”button” value=”Click me…” onclick=”alert(‘Thanks… I feel much better now!’);” />

Alert – Before Page Loads

<div style=”text-align:center;padding:10px;”>
<h1>Amazing Web Page</h1>
<script type=”text/javascript”>
alert(‘But wait, there\’s more…’);
<p><a href=”JavaScript:self.close();”>Close This Page!</a></p>

Alert – After Page Loads

<script type=”text/javascript”>
function alertUser(msg) {
<body onload=”alertUser(‘Welcome to this AMAZING web page!’)”>
<div style=”text-align:center;padding:10px;”>
<h1>Amazing Web Page.</h1>
<p><a href=”JavaScript:self.close();”>Close</a></p>

Alert – Within Another Function

<script language=”javascript” type=”text/javascript” >
function jumpto(x){

if (document.form1.jumpmenu.value != “null”) {
if (document.form1.jumpmenu.value != “;) {
alert(‘Sorry to see you leaving Quackit. Hope to see you back soon!’);
document.location.href = x
<form name=”form1″>
<select name=”jumpmenu”
<option>Jump to…</option>
<option value=””>Quackit Homepage</option>
<option value=””>ZappyHost</option&gt;
<option value=””>Code Generator</option>
<option value=””>Natural Environment</option>
<option value=””>Great Workout</option>

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s