日期:2014-05-16  浏览次数:20317 次

js+html
web网页里有单选框和ok按钮,用js和html实现单击ok按钮后单选框消失,在单击ok按钮单选框出现。。。。。反复下去 
JavaScript HTML Web

------解决方案--------------------

<!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>


------解决方案--------------------
<!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