One.
Three common dialog boxes:
1. Must be written in <scrip></scrip>
<body><font>alert ("error") </font><br/><br/></body>
Write in body, display only text
2.
</body>alert ("error") confirm ("Do you really want to quit?") prompt ("Lose a number come in", "can only be a number Oh")
Alert ("")
Warning dialog box, function is to pop up a warning dialog box
Confirm ("")
Determines the dialog box, the function is to pop up a selection of OK dialog box, click OK to return True, point cancel return False
Prompt ("", "" ")
The function is to pop up a dialog box that allows you to enter content
Two. Method of writing and calling
Defining variables with: Var a
Define method with: function add (formal parameter) {}
Call method with: Add (argument)
<body><br/><br/><br/><input type= "button" value= "Submit" onclick= "AA ()"/></body> function aa () { var a=1; A=a+A; alert (a);} </script>
Here we define a method of AA
In body, create a new button to invoke the method AA with the button's Click event (onclick)
The output is:
Before the button is clicked:
After clicking the button:
javascrip--Beginner (three common dialog boxes and method calls)