这可能是一个非常愚蠢的问题,但我无法弄清楚该站点的 javascript 命令来根据文本字段是否实际填充来决定是否填充文本字段。我的代码在这里。
<html>
<head>
<title>Contact Us</title>
<link rel="stylesheet" type="text/css" href="main.css">
<style type="text/css">
#main-container{
padding-left: 3px;
padding-right: 3px;
}
#left-bar{
text-align: right;
}
#left-bar, #right-bar{
border: 2px solid gray;
}
#top-nav-bar{
border-top: 1px solid gray;
border-bottom: 2px solid gray;
border-left: 2px solid gray;
border-right: 2px solid gray;
}
#navTextn{
float: right;
padding-right: 20px;
padding-top:10px;
}
#navTextc{
float: right;
padding-right: 20px;
padding-top:10px;
}
#navTexth{
float: right;
padding-right: 20px;
padding-top:10px;
}
#Contus{
float:right;
padding-right: 30px;
padding-top:10px;
}
#logo{
height: 20px;
width: 100px;
padding-top: 10px;
padding left: 10px;
}
</style>
<script type="text/javascript">
function validator(){
if(document.mUs.bfinderm.text)
alert("Thank you for your submission");
else
alert("No text has been entered");
}
</script>
<title>Tickit</title>
</head>
<body id="body">
<div id="topline">
</div>
<div id="top-nav-bar">
<a href="Homework.html"><image id="Logo" src="Tickit.png"></a>
<a id="Contus" href="ContactUs.html">Us</a>
<a id="navTextn">News</a>
<a id="navTextc" href="Calendar.html">Calendar</a>
<a id="navTexth" href="Homework.html">Home</a>
</div>
<table id="main-container">
<tr>
<td id="left-bar" valign="top">
<a id="plinks" >Profile</a><br>
<a id="plinks" >Mail</a><br>
<a id="plinks" href="Homework.html">Work Stream</a><br>
<a id="plinks" href="calendar.html">Calendar</a><br>
<a id="plinks" href="Events.html">Events</a><br>
</p>
</td>
<td id="main" valign="top">
If you find any bugs with the website, please leave a message to us in the box below <br> <br>
<form name="mUs">
Message Us:<br> <input type="text" name="bfinderm" />
<input type="button" value="Send" onClick="validator()" />
</form>
</td>
<td id="right-bar" valign="top">
</td>
</tr>
</table>
</body>
</html>
就像在复选框中一样,validator() 代码将被选中
<script type="text/javascript">
function validator(){
if(document.stackflowrun.stflr.checked)
alert("Yes it is checked!");
else
alert("Check that shit boul!");
}
</script>
那么文本字段选项的等效验证器()命令是什么?
function validator(){
if(document.mUs.bfinderm.text)
alert("Thank you for your submission");
else
alert("No text has been entered");
}
</script>
(文字不是这样)