javascript onsubmit attribute


  Translation results:

on

英[ɒn]   美[ɑ:n]  

prep. (indicating direction) to; (indicating object) to; (indicating position) on...; (indicating time) at the time of...

adv. (put, wear, connect) on; forward, (continue) go on

adj. active situation, state ; in use; happening; planned ; Be willing to accept, endure

vt. Make obedient, make obedient; submit, submit; [Law] advocate, suggest Third person singular: submits Present participle: submit Past tense: submit Past participle: submitted

javascript onsubmit attributesyntax

Function: Occurs when the confirmation button in the form is clicked.

Syntax: onsubmit="SomeJavaScriptCode"

Parameters: SomeJavaScriptCode Required. Specifies the JavaScript to be executed when this event occurs.​

javascript onsubmit attributeexample

<html>
<head>
    <meta charset="UTF-8">

</head>

<body>

<form name="testform" action="" onsubmit="alert('Hello ' + testform.fname.value +'!')">

你的名字?<br />
<input type="text" name="fname" />
<input type="submit" value="Submit" />
<p>输入文本点击提交查看效果</p>
</form>

</body>

</html>

Run instance »

Click the "Run instance" button to view the online instance

Home

Videos

Q&A