如何运行此命令
How to run this command?
我希望警报"请选择进入级别"与警报"您必须输入考试编号"和其他两个一起。进入警报级别优先于其他警报。
如果有人帮助我,我将不胜感激。谢谢!
function validateForm()
{
var result = true;
var msg="";
var checked = null;
var inputs = document.getElementsByName('level');
for (var i = 0; i < inputs.length; i++)
{
if (inputs[i].checked)
{
checked = inputs[i];
}
}
if (checked==null)
{
alert('Please choose a level of entry.');
document.getElementById('radio').style.color="red";
result=false;
}
else {
var r=confirm('You have chosen '+checked.value+', do you wish to proceed? 'n')
if (r==true)
{
result=true;
}
else
{
result=false;
}
}
if (document.ExamEntry.name1.value=="") {
msg+="You must enter your name 'n";
document.ExamEntry.name1.focus();
document.getElementById('name').style.color="red";
result=false;
}
if (document.ExamEntry.subject1.value=="") {
msg+="You must enter the subject 'n";
document.ExamEntry.subject1.focus();
document.getElementById('subject').style.color="red";
result=false;
}
if (document.ExamEntry.exam1.value=="") {
msg+="You must enter the examination number 'n";
document.ExamEntry.exam1.focus();
document.getElementById('exam').style.color="red";
result=false;
}
if(msg=="") {
return result;
}
{
alert(msg);
return result;
}
}
我理解你的意思。。。你应该连接字符串msg,以及。。。
if (checked==null)
{
msg+="Please choose a level of entry.";
document.getElementById('radio').style.color="red";
result=false;
}
最后再加一个:
if(msg=="") {
return result;
} else {
alert(msg);
return result;
}
相关文章:
- http.listen()在运行时接受终端命令
- 如何在没有单词的情况下从命令行运行Node.js程序'节点'
- 在Flask中使用.getJSON请求时,只运行一次命令
- PHP:运行后变量不工作“;如果“;命令
- 如何在节点模块中从命令行运行函数
- 如何在命令行中运行/调试javascript
- 无法运行安卓.bat文件.xcopy 命令停止执行
- grunt 命令在配置 EaselJS 项目时不运行服务器
- 如何在 JavaScript 中运行 shell 命令
- 在命令运行时以Grunt显示输出
- 从命令行运行JS文件
- 如何在命令提示符下运行js文件
- 运行--eval mongodb命令时出错
- 打开时运行命令的Illustrator文件
- 无法通过 npm 脚本“babel:找不到命令”运行 babel
- 谷歌浏览器同步存储“获取”命令运行什么顺序
- JavaScript 在命令运行太早时打开新窗口而不是选项卡
- 为什么相同的javascript可以使用runscript命令运行,但不能在RC中的getEval中运行
- 如何使用自定义命令运行节点文件
- 如何使用单个命令运行多个QUnit(node.js)测试文件