Working with the Alert, Confirm, and Prompt Methods : Dialog : Window Browser JAVASCRIPT DHTML TUTORIALS


JAVASCRIPT DHTML TUTORIALS » Window Browser » Dialog »

 

Working with the Alert, Confirm, and Prompt Methods



<HTML>
<HEAD>
<TITLE>Simple dialogs</TITLE>
<SCRIPT
   function showAlert(inText) { 
      alert (inText)
   
   function showConfirm(){ 
      if (confirm("True or False?"== true
         return "true" 
      else 
         return "false"
   
   function showPrompt(inText){ 
      var retVal = "" 
      retVal = prompt(inText, "FirstName LastName")
      if (retVal == "" || retVal == null
         return "nameless one"
      else 
         return retVal; 
   
   </SCRIPT>
</HEAD>
<BODY>
<FORM Name="theForm">
<TABLE cellspacing=5>
<TR>
<TD>
<INPUT Type=Text Name="alertText" Size=40>
<TD>
<INPUT Type=Button Value="Alert" onClick='showAlert(alertText.value);'>
</TR>
<TR>
<TD>
<INPUT Type=Text Name="decisionText" Size=40>
<TD>
<INPUT Type=Button Value="Confirm" onClick='decisionText.value=showConfirm();'>
</TR>
<TR>
<TD>
<INPUT Type=Text Name="nameText" Size=40>
<TD>
<INPUT Type=Button Value="Prompt" onClick='nameText.value = "Hello, " + showPrompt("What is your name?");'>
</TR>
</TABLE>
</FORM>
</BODY>
</HTML>
           
       



-

Leave a Comment / Note


 
Verification is used to prevent unwanted posts (spam). .

Follow Navioo On Twitter

JAVASCRIPT DHTML TUTORIALS

 Navioo Window Browser
» Dialog