There are three types of dialog boxes
1: Just reminders, can not make any changes to the script;
2: Generally used to confirm, return TRUE or false, so it can be easily used for if...else ... Judge
3: A dialog with the input, you can return the user fill in the string, common in some of the message or forum input content there insert UBB format picture
Below we demonstrate separately:
1<% @LANGUAGE = "JAVASCRIPT" codepage= "936"%>2<! DOCTYPE HTML PUBLIC "-//W3C//DTD XHTML 1.0 transitional//en" "Http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd ">345<meta http-equiv= "Content-type" content= "text/html; charset=gb2312 "/>6<title> Three examples of usage of pop-up dialog boxes </title>7<script language= "JavaScript" >8 functionAle ()9{//This is basically nothing to say, is to pop up a reminder of the dialog boxTenAlert ("I'm sure you're using demo one now.")); One } A functionfirm () -{//value returned using the dialog box (TRUE or False) - if(Confirm ("Are you sure you want to go to the sky-blasted blog?") ")) the{//If it is true, then turn the page to thcjp.cnblogs.com -location.href= "Http://thcjp.cnblogs.com"; - } - Else +{//Otherwise, it's a show, hehe. -Alert ("You hit Cancel, that's return false"); + } A } at functionProm () - { - varName=prompt ("Please enter your name", "");//assign the input to the variable name, - //It is important to note that prompt has two parameters, preceded by a hint, followed by the default value in the dialog box after the dialog box comes out . - if(name)//If the returned content is - { inAlert ("Welcome:" +name) - } to } +</script> - the *<body> $There are three types of <p> dialog boxes </p>Panax Notoginseng<p>1: Just a reminder that you can't make any changes to the script;</p> -<P>2: Generally used to confirm, returntrueOrfalse, so it can be easily used in the usage instance of the three pop-up dialogs in ifjsp elsejsp to judge the usages of three pop-up dialog boxes </p> the<p>3: A dialog box with input, you can return the user fill in the string, common in some message book or forum input there insert UBB format picture </p> +<p> below we demonstrate:</p> A<p> Demo One: Reminder dialog box </p> the<p> +<input type= "Submit" name= "submit" value= "Submit" onclick= "ale ()"/> -</p> $<p> Demo Two: confirmation dialog box </p> $<p> -<input type= "Submit" Name= "Submit2" value= "Submit" onclick= "firm ()"/> -</p> the<p> Demo Three: Require user input, and then give a result </p> -<p>Wuyi<input type= "Submit" Name= "Submit3" value= "submit" onclick= "Prom ()"/> the</p> -</body> Wu
- Pass value to function, jump to specify URL
<script type= "Text/javascript" > function firm (id) { if(Confirm ("OK" to delete? ")) { Location.href=" addressservlet?method=delete&id= "+ID; } Else { alert ("or do not delete");} } </script><!-- --><input type= "Submit" Name= "Submit2" value= "Delete" onclick= "Firm (${a.id})"/>
Examples of usages of "JSP" three popup dialog boxes