Search results for 'Dialog'. 1 post(s) found.

  1. 2009/08/22 Javascript Prompts
2009/08/22 22:29

Javascript Prompts


Javascript is also providing propmpt method for various purpose. This method will be very useful if you make AJAX application.

Follwing example will bring up a window asking the Question of your choosing, with a space for the viewer to answer. The second set of quotes allows you to enter a default answer. If you leave it blank, the viewer will just see an empty box ready to be typed in. This is usually done before the page loads, so that you can write the answer they give into your page.

<SCRIPT language="JavaScript">
<!--hide  
 var yourname= Prompt('Please enter your name, so you can get a special greeting', ' ');

 if ( (yourname==' ') || (yourname==null) )
 {
   yourname="Dude";
 }

//-->
</SCRIPT>

</HEAD>

<BODY>

<SCRIPT language="JavaScript">
<!--hide
 document.write("<CENTER><H1>Hello, " + yourname + " ! Welcome to My Page! <\/H1><\/CENTER>");

//-->
</SCRIPT>

</BODY>

Trackback 0 Comment 0

Trackback : Cannot send a trackbact to this post.