web网页里有单选框和ok按钮,用js和html实现单击ok按钮后单选框消失,在单击ok按钮单选框出现。。反复下去 JavaScriptHTMLWeb
解决方案 »
- enter按钮事件如何把按钮转到easyui的combobox,datetimebox等事件上去啊?
- "对联"广告的效果怎么做?
- 写一JS,实现分配功能
- 我用 document.getElementById("tip").innerHTML=xmlhttp.responseText; 返回了后台处理的数据
- 在safari浏览器下,用javascript怎么改变标签的长度?
- 有关checkbox的这个用法,不知如何下手,请高手出山相助,谢谢!!!!
- 如何跨服务器传值!
- 用javascript能不能在客户机生成一个文件
- javascipt定义的变量如何在java中使用?可以吗?
- 在使用HTC定义事件时能否传递参数?比如在表格的行上定义:<attach event="onclick" onevent="click()"/>在单击行时,想行到该行的行号及
- 谁帮忙看一下jQuery ScrollPagination
- 大家帮忙看一下 调用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=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<title>无标题文档</title>
</head><body>
<div id="sexoption">
<input type="radio" name="sex" value="1" />body
<input type="radio" name="sex" value="2" />girl
</div>
<input type="button" id="btn" value="choose" /><script type="text/javascript">
jQuery(function ($) {
$("#btn").click(function () {
if($('#sexoption').css('display')=='block'){
$('#sexoption').hide();
}else{
$('#sexoption').show();
}
});
});
</script>
</body>
</html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<title>无标题文档</title>
</head>
<body>
<div id="sexoption">
<input type="radio" name="sex" value="1" />body
<input type="radio" name="sex" value="2" />girl
</div>
<input type="button" id="btn" value="choose" onclick="changeState()"/>
<script type="text/javascript">
function changeState(){
var sexoption=document.getElementById("sexoption");
sexoption.style.display=sexoption.style.display=="none"?"":"none";
}
</script>
</body>
</html>
document.getElementById('btn').onclick=function(){
var s=document.getElementById('sexoption');
var status=(s.style.display == 'none');
if(status){
document.getElementById( 'sexoption' ).style.display="block";
}else{
document.getElementById( 'sexoption' ).style.display="none" ;
}
}
<!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=utf-8" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js"></script>
<title>无标题文档</title>
</head><body>
<select name="sex" id="sex" size="1">
<option value="1">body</option>
<option value="2">girl</option>
</select>
<div id="sexoption">
<!--<input type="radio" name="sex" value="1" />body
<input type="radio" name="sex" value="2" />girl-->
</div><input type="button" id="btn" value="choose" /><script type="text/javascript">
/*jQuery(function ($) {
$("#btn").click(function () {
if($('#sexoption').css('display')=='block'){
$('#sexoption').hide();
}else{
$('#sexoption').show();
}
});
});*/
document.getElementById('btn').onclick=function(){
var s=document.getElementById('sex');
var rehtml="";
var radioName=s.getAttribute('name');
//alert(radioName);
for(var i=0;i<s.options.length;i++){
rehtml+="<input type=\"radio\" name=\""+radioName+"\" value=\""+ s.options[i].value+"\"/>"+s.options[i].text;
}
var racontainer=document.getElementById('sexoption');
if(racontainer.getElementsByTagName('input').length>1){
document.getElementById('sexoption').innerHTML="";
}else{
document.getElementById('sexoption').innerHTML= rehtml;
}
/*var s=document.getElementById('sexoption');
var status=(s.style.display == 'none');
if(status){
document.getElementById( 'sexoption' ).style.display="block";
}else{
document.getElementById( 'sexoption' ).style.display="none" ;
}*/
}
</script>
</body>
</html>