我有一个带有单选按钮字段的Sharepoint列表。如果有人检查不,则应禁用ok按钮,但如果选择yes,则应启用ok按钮。 我需要在CEWP中编写一个javascript来实现这一点而无法访问SPD,有人可以建议吗?
答案 0 :(得分:0)
<script type = "text/javascript">
function test_enable(id,id2)
/*parameter "id" should be id of "no" radiobutton and "id2" is of yes button
*/
{
if(document.getElementById(id).checked==true)
{
document.getElementById(id2).enabled==false;
}
else
{
document.getElementById(id2).enabled==true;
}
}
</script>
<input type = "radio" id = "id" onchange = "test_enable('id','id2')" value = "No">
<input type = "button" id = "id2" onclick = "foo()" value = "click me!">
简单!
答案 1 :(得分:0)
你可以做这样的事情
function show_hide(show, hide)
{
document.getElementById(show).style.display="block";
document.getElementById(hide).style.display="none";
}
<form method="post" action="aaa.php">
<input type="radio" name="search" value="standard" onClick="show_hide('standard', 'advanced')" checked />Standard Search
<div id="standard" style="display: block;">
Standard search div
</div>
<br />
<input type="radio" name="search" value="advanced" onClick="show_hide('advanced', 'standard')" />Advanced search
<div id="advanced" style="display: none;">
Advanced search div
</div>
<br />
<input type="submit" value="Submit" />
</form>