导航:首页 > 编程语言 > js性别选择控件

js性别选择控件

发布时间:2022-09-20 17:27:24

『壹』 js两个radio,选择的问题

if(a==1)
{
document.getelementById("Ra1").checked=true;//男选中
document.getelementById("Ra1").checked=false;//女不选中
}
else
{
document.getelementById("Ra1").checked=false; //男不选中
document.getelementById("Ra1").checked=true;//女选中
}

『贰』 js编写注册表,性别以单选钮选择输入,密码框显示不可见字符

不需要js好不
<form action="" method="post">
用户名:
<input type="text" name="username" />
<br />
密码:
<input type="password" name="pwd" />
<br />
性别:

<input type="radio" name="sex" value="男" />


<input type="radio" name="sex" value="女" />
<input type="submit" value="提交" />
</form>

『叁』 js性别验证 求解!!

2个问题
radio控件要用数组,
if(form.u_sex[0].value!="f" && form.u_sex[1].value!="m"){alert("请选择性别");
这个还不行,上面的条件是没有内判断作用的容,,你在函数checkpost() 里加入
alert(form1.u_sex[0].value);
alert(form1.u_sex[1].value);
就知道了
正确的判断语句为 if(!form1.u_sex[0].checked && !form1.u_sex[1].checked)

『肆』 用JS做一个弹出框。显示内容为选择性别,该怎么处理

用JS做一个弹出框。显示内容为选择性别 就是日历控件一样,当鼠标在文本框中一点。那么就弹出一个小框框。选择性别:男或女 按了男或女之后。将内容回填到鼠标点中的那个文本框中。 ------解决方案--------------------用模式窗口的例子: 第一个页面:<html><body>单击选择性别: <input type = "text " name = "userSex " readOnly onclick= "loadSmallWindow(this) " code= " "></body><script language= "javascript "> function loadSmallWindow(obj){var returnValue = showModalDialog( "second.html ",window, "dialogWidth:150px;dialogHeight:90px;status:no "); document.all( "userSex ").value = returnValue;}</script></html>窗口页面second.html:<html><body><select name = "sel_sex "> <option value = "男 "> 男 </option> <option value = "女 "> 女 </option></select><input type= "submit " value = "确定 " onclick= "aa() "></body><script language= "javascript "> window.returnValue = " "; function aa(){window.returnValue = document.all( "sel_sex ").value; window.close();}</script></html>------解决方案--------------------用层做的例子:<html><body><div id= "div " style= "width:150px;height=90px;display:none;background-color:#ffffee;boder-collapse:collapse;border-color:#000000;border-style:solid;border-width:1px;position:absolute;z-index:100 "> <select name = "selSex "> <option value = "男 "> 男 </option> <option value = "女 "> 女 </option> </select> <input type= "button " name = "btnOk " value = "确定 "> </div> 单击选择性别:

『伍』 js弹出框显示请选择 性别和单选按钮男女和一个确认按钮 如何实现

js中alert()方法就可以实现这种效果。种效果常用于表单验证时弹出提示信息。

下面是用jquery编写的表内单验证的简单例子容:

<html>
<body>
<scripttype="javascript/text"src="jquery.js"></script>
<formid="form"method="post"action="">
性别:男<inpyttype="radio"name="sex"value="0">女<inpyttype="radio"name="sex"value="1">
<inpyttype="button"id="button"value="提交">
</form>
<scripttype="javascript/text">
$("#button"),click(function(){//提交按钮被点击触发
if($("input[name='sex']").is("checked")){//获取name为sex的input的对象并判断是否被选中
$("#form").submit();");//如果性别的单选按钮有被选择则提交表单
}else{
alert("请选择性别");//如果性别的单选按钮没有被选择则弹出提示
}
});
</script>
</body>
</html>

『陆』 js性别选择问题

if(sex[i].checkbed){

改为
if(sex[i].checked){

细心啊!

『柒』 js 性别判断 textarea下面有个按钮如果是男点击按钮在下面的textarea中输出内容如果是女输出另一些内容

<%
Dim Sex
Sex="女"
%>
<textarea id="Con" name="Con" rows="6" cols="60"></textarea>
<input type="button" value="显示" onclick="ShowMsg();">
<script>
function ShowMsg()
{
var sex='<%=Sex%>';//你通过网传过来的性别,男或女
var Con=document.getElementById('Con');
版if (sex=='男')
{
Con.value='我是男生权';
}
else
{
Con.value='我是女生';
}
}
</script>

『捌』 javascript 单选框性别必须选择,否则弹出消息 ("性别必须选择!"); 谢谢!

if(radio[i].checked==ture){ ture 改成 true 你只是写反了一个字母。

『玖』 关于JavaScript中表单性别按钮验证的问题

可以使用Jquery的is()方法更轻松的解决这个问题。
is() 根据选择器、元素或 jQuery 对象来检测匹配元素集合,如果这些元素中至少有一个元素匹配给定的参数,则返回 true。

<formaction=""method="post"onsubmit="returnyanzheng()">
性别:<inputtype="radio"name="sex"value="男"/>男<inputtype="radio"name="sex"value="女"/>女
<inputtype="submit"value="提交"/>
</form>
<script>
functionyanzheng(){//当表单提交时触发的验证方法
if(!$("input[name='sex']").is(":checked")){//如果name为sex的input没有被选中
alert('未选中');//弹出提示
returefalse;//返回假值表单不会提交
}else{
returntrue;//返回真值表单提交
}
}
</script>

『拾』 js中 我要再页面做一个双击显示下拉菜单的功能 具体是在性别输入栏 双击后 下拉出男女供选择

干嘛用双击呢?不累吗?用单击不是更好?
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
<style type="text/css">
<!--
#x{width: 69px;padding: 6px;border: 1px solid #000000;position: absolute;left: 11px;top: 40px;display: none;}
#x a{display: block;line-height: 25px;color: #000000;text-decoration: none; font-size:12px;}
#x a:hover{color: #FFFFFF;text-decoration: underline;background-color: #000000;font-weight: bold; font-size:12px;}
-->
</style>
<script language="JavaScript">
<!--
var pos=function(str){
var Left=0,Top=0;
do{Left+=str.offsetLeft,Top+=str.offsetTop;}
while(str=str.offsetParent);
return {"Left":Left,"Top":Top};
}
function abc(str){
with(pos(str)){
document.getElementById('x').style.top=Top+22;
document.getElementById('x').style.left=Left;
}}
//-->
</script>
</head>

<body>
<input name="xingbie" type="text" id="xingbie" size="10" onclick="document.getElementById('x').style.display='inline';abc(this);">
<div id="x">
<a href="JavaScript:" onclick="document.getElementById('xingbie').value=this.innerText;document.getElementById('x').style.display='none';">男</a>
<a id="x2" href="JavaScript:" onclick="document.getElementById('xingbie').value=this.innerText;document.getElementById('x').style.display='none';">女</a></div>
</body>
</html>

阅读全文

与js性别选择控件相关的资料

热点内容
删除一个文件夹找不到了 浏览:654
电脑桌面文件管理哪个软件好 浏览:188
苹果数据线头歪了 浏览:135
ghostwin764位系统镜像文件 浏览:443
传感器视频教程下载 浏览:95
flash源文件贺卡下载 浏览:434
如何提高网络扶贫的效果 浏览:654
飞车软件文件夹叫什么 浏览:242
刷ec用什么编程器 浏览:765
方菱数控u盘文件格式 浏览:260
编程为什么输出两个变量 浏览:490
卫星大锅2017用升级吗 浏览:113
玉米win10系统下载 浏览:134
fgo技能升级减cd吗 浏览:129
什么记账app免费好用 浏览:441
网络检测可以检测到什么 浏览:504
sip协议教程 浏览:832
编程哪里可以接项目 浏览:119
孤岛惊魂win10 浏览:246
网络HRV是什么意思 浏览:918

友情链接