2013-03-15 135 views
1

我有一個帶有單選按鈕字段的Sharepoint列表。如果有人檢查沒有,那麼它應該禁用ok按鈕,但是如果選擇了yes,則應該啓用ok按鈕。 我需要在CEWP中編寫一個JavaScript來實現這個功能,但不能訪問SPD,有人可以提供建議嗎?根據單選按鈕選擇隱藏確定按鈕

回答

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

簡單!

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>