分类:
2006-04-10 00:17:20
- <form method=”post” action=”target.html” name=”thisForm”>
- <
input type=”text” name=”myText”>
- <
select name=”mySelect”>
- <
option value=”1”>First Choiceoption>
- <
option value=”2”>Second Choiceoption>
select>
- <
br>
- <
input type=”submit” value=”Submit Me”>
form>
- <form name=”myForm”>
- <
input type=”text” name=”myText”>
form>
- <
a href='#' onClick='window.alert(document.myForm.myText.value);'>Check Text Fielda>
- <form name=”myForm”>
Enter some Text: <input type=”text” name=”myText”><br>
Copy Text: <input type=”text” name=”copyText”>
form>
- <
a href=”#” onClick=”document.myForm.copyText.value =
document.myForm.myText.value;”>Copy Text Fielda>
- <form name=”myForm”>
Enter some Text: <input type=”text” name=”myText” onChange=”alert(this.value);”>
form>
- <form name=”myForm”>
- <
select name=”mySelect”>
- <
option value=”First Choice”>1option>
- <
option value=”Second Choice”>2option>
- <
option value=”Third Choice”>3option>
select>
form>
- <
a href='#' onClick='alert(document.myForm.mySelect.value);'>Check Selection Lista>
- <form name=”myForm”>
- <
select name=”mySelect”>
- <
option value=”First Choice”>1option>
- <
option value=”Second Choice”>2option>
select>
form>
- <
script language=”JavaScript”>
document.myForm.mySelect.length++;
document.myForm.mySelect.options[document.myForm.mySelect.length - 1].text = “3”;
document.myForm.mySelect.options[document.myForm.mySelect.length - 1].value = “Third Choice”;
- <script language=”JavaScript”>
- function
checkField(field) {
- if (
field.value == “”) {
window.alert(“You must enter a value in the field”);
field.focus();
- }
- }
- function checkList(selection) {
- if (
selection.length == 0) {
window.alert(“You must make a selection from the list.”);
- return
false;
- }
- return
true;
- }
- <form name=”myForm” action=”login.html”>
Username: <input type=”text” name=”username”><br>
Password: <input type=”password” name=”password”><br>
- <
input type=”button” value=”Login” onClick=”this.form.submit();”>
- <
input type=”button” value=”Register” onClick=”this.form.action = ‘register.html’; this.form.submit();”>
- <
input type=”button” value=”Retrieve Password” onClick=”this.form.action = ‘password.html’; this.form.submit();”>
form>
- <form name=”myForm” action=”login.html”>
Username: <input type=”text” name=”username”><br>
Password: <input type=”password”name=”password”><br>
- <
input type=”image” src=”login.gif” value=”Login”>
form>
//注意:图像按钮在表单中的作用相当于提交按钮
- <SCRIPT LANGUAGE='JavaScript'>