<form name=f>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=button onclick="test()" vaLUE="TEST">
</form>
<script>
function test()
{
var a=document.f;
if(a.txt) alert("存在")
else
alert("不存在")}
</script>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=button onclick="test()" vaLUE="TEST">
</form>
<script>
function test()
{
var a=document.f;
if(a.txt) alert("存在")
else
alert("不存在")}
</script>
解决方案 »
- 什么是正弦?什么是余弦?什么是反余弦?
- 动态radio改为button,radio源码如下
- javascript调用客服端的exe程序报错:Automation 服务器不能创建对象
- js自动编号并将编号值赋到指定文本框
- 谁有gis的客户端?js的,能实现放大缩小托拽等功能,能加载位图,谁有?给我一份,谢谢!
- 请帮忙看看我这段代码有什么问题?
- 在IFrame中使用<a href="javascript:XXXFunction();" target="_parent" style="text-decoration></a>
- 页面关闭的问题!
- 求这个菜单的代码,(在线)!
- 大家快来讨论一下Word.Applacation的启动条件?
- 谁帮我写一个简单的改变字体颜色的javascript函数?
- 这个功能是怎么实现的
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=button onclick="test()" vaLUE="TEST">
</form>
<script>
function test()
{
var a=document.f;
if(a.txt)
alert("txt存在")
else
alert("txt不存在")if(a.txt2)
alert("txt2存在")
else
alert("txt2不存在")
}
</script>
<input type=radio name=txt>
<input type=radio name=txt>
<input type=checkbox name=txt>
<input type=checkbox name=txt>
<input type=button onclick="test()" vaLUE="TEST">
</form>
<script>
function test()
{
var a=document.f;
if(a.txt)
{
for(i=0;i<a.txt.length;i++)
{
alert("有一个名为txt的"+a.txt[i].type);
}
}
else
alert("txt不存在")if(a.txt2)
alert("txt2存在")
else
alert("txt2不存在")
}
</script>
<input type=radio name=txt>txt
<input type=radio name=txt>txt
<input type=radio name=txt3>txt3
<input type=radio name=txt4>txt4
<input type=button onclick="test('txt')" vaLUE="test txt">
<input type=button onclick="test('txt2')" vaLUE="text txt2">
<input type=button onclick="test('txt3')" vaLUE="test txt3">
<input type=button onclick="test('txt5')" vaLUE="text txt5">
</form>
<script>
function test(strName){alert(strName+(document.f(strName)?"":"不")+"存在");}
</script>