<form name="form1" method="post" action="" target="mainFrame" onsubmit="return func()">
function func(){
var flag="aaaa"
var a=document.getElementsByName("mobiletelephone")
for(var i=0;i<a.length;i++){
if(a[i].checked==false){
flag="bbb"
}
}
if(flag=="aaaa"){
alert("no chekced");
return false;
}else{
return true;
}
}
function func(){
var flag="aaaa"
var a=document.getElementsByName("mobiletelephone")
for(var i=0;i<a.length;i++){
if(a[i].checked==false){
flag="bbb"
}
}
if(flag=="aaaa"){
alert("no chekced");
return false;
}else{
return true;
}
}
解决方案 »
- 利用Javascript 可不可以动态设置桌面啊
- 送分:聊天室前台显示的问题!
- js问题
- 请教一个弹出 DIV 定位的问题。
- 一个窗口中用window.open打开了很子子窗口,怎样把这些子窗口一次全部关闭?
- 我用sun.misc.BASE64Encoder进行编码,但在JAVACRIPT中怎么解码啊?从网上找了一些,不能用,特别是处理中文时。HELP ME!
- js脚本是如何执行的?像SOHU那样的首页制作方法谁知道(送高分)
- 小問題,一小時結帖
- select 表单中的option可以动态增加吗?
- 实在搞不定了
- 高分求助在线等:type=file选择图片后,想在页面显示出来怎么办?
- 如何在数组中间插入一个值?????????
var flag="aaaa"
var a=document.getElementsByName("mobiletelephone")
for(var i=0;i<a.length;i++){
if(a[i].checked==true){
flag="bbb"
}
}
if(flag=="aaaa"){
alert("no chekced");
return false;}else{
return true;
}
}
<input type="radio" name="mobiletelephone" value="" ID="Radio1">
<input type="radio" name="mobiletelephone" value="" ID="Radio2">
<input type="radio" name="mobiletelephone" value="" ID="Radio3">
<input type="radio" name="mobiletelephone" value="" ID="Radio4">
</form>
<input type=submit onclick="return check()" value="submit">
<script>
function check()
{
var rd = document.getElementsByName("mobiletelephone");
var flag = false;
for(var i=0;i<rd.length;i++)
{
if(rd[i].checked) flag = true;
}
if(!flag)
{
alert("没选啊")
return false;
}
myform.submit();
return true;
}
</script>
var flag=0
var a=document.getElementsByName("mobiletelephone")
for(var i=0;i<a.length;i++){
if(a[i].checked==true){
flag=flag+1;
}
}
if(flag=="0"){
alert("no chekced");
return false;}else if(flag=="1"){
alert("no only check 1");
return false;
}else{
return true;
}
}
这只是你的思想的问题
<input type=reset value="reset">
<form name="form1" method="post" action="" target="mainFrame" onsubmit="return func()">
<input type="checkbox" name="mobiletelephone" value="" ID="Radio1">
<input type="checkbox" name="mobiletelephone" value="" ID="Radio2">
<input type="checkbox" name="mobiletelephone" value="" ID="Radio3">
<input type="checkbox" name="mobiletelephone" value="" ID="Radio4">
</form>
<input type=submit value="submit">
<script>
function func(){
var flag=0
var a=document.getElementsByName("mobiletelephone")
for(var i=0;i<a.length;i++){
if(a[i].checked==true){
flag=flag+1;
}
}
if(flag=="0"){
alert("no chekced");
return false;}else if(flag=="1"){
alert("no only check 1");
return false;
}else{
return true;
}
}
</script>