<!DOCTYPE HTML><HTML><Head><MetaCharSet= "Utf-8"><title>Beginner's Tutorial (runoob.com)</title><Scripttype= "Text/javascript"> functionSave () {alert ("block A-tagged href request submission 1"); <!--This only simulates the verification process before the form is submitted, and the real JS verification code can be written in the Save () method - }</Script></Head><Body> <P>Click on the link below to view the results:</P><a href= "javascript:void (0)" onclick = "Save ()">Point me to submit a request!</a></Body></HTML>
The second way:
1 <!DOCTYPE HTML>2 <HTML>3 <Head>4 <MetaCharSet= "Utf-8">5 <title>Beginner's Tutorial (runoob.com)</title>6 <Scripttype= "Text/javascript">7 function Save (){8 Alert ("block A-tagged href request submission");9 <!--This only simulates the verification process before the form is submitted, and the real JS verification code can be written in the Save () method -Ten } One </Script> A </Head> - <Body> - the <P>Click on the link below to view the results:</P> - <ahref= "javascript:void (Save ())">Point me to submit a request!</a> - </Body> - </HTML>
A tag specifies the URL, the implementation of the JS verification before the form submission