|
|
|
ขอสอบถามว่าถ้าจะทำให้ combobox disable โดยดูว่า radio button ถูกเลือกหรือไม่ |
|
|
|
|
|
|
|
ลองดูน่ะครับ โค้ดชุดนี้แก้ไขให้แล้ว แต่รู้สึกว่าที่ผมเพิ่มเติมให้มันดูมั่วๆชอบกล ตอบกลับมาด้วยน่ะครับ
<!--<meta http-equiv="Content-Type" content="text/html; charset=tis-620" />-->
<title>TriConsole - Programming, Web Hosting, and Entertainment Directory</title>
<link rel="stylesheet" type="text/css" href="datepick/css/smoothness/jquery-ui-1.7.2.custom.css">
<script src="http://code.jquery.com/jquery-latest.js"></script>
</head>
<body>
<?php
$year=date('Y');
$nyear = $year + 543;
?>
<form id="form1" name="form1" method="post" action=" ">
<label>
<input name="rdo1" type="radio" rel="cboYear" value="Y" onClick="this.form.submit(); javaScript:if(this.checked){document.form1.cboYear.disabled=false;}" <? if($_POST['rdo1'] == "Y"){ echo "checked"; } ?>>
<select name="cboYear" id="cboYear">
<?php
for ( $i = 0; $i <= 5; $i += 1) {
echo "<option value = '{$nyear}'>{$nyear}";
$nyear = $nyear - 1;
}
?>
</select>
<input name="rdo1" type="radio" rel="importFiles" value="N" onClick="this.form.submit(); javaScript:if(this.checked){document.form1.cboYear.disabled=true;}" <? if($_POST['rdo1'] == "N"){ echo "checked"; } ?>>
<div id="importFiles">
<?php
if ($_POST['rdo1'] == "N" ){
echo ("<br>");
include("test2.php");
}
elseif($_POST['rdo1'] == "Y" ){
}
?>
</div>
</label>
<br><center><input name="btnSubmit" type="submit" value ="ตกลง"></center>
</form>
<p> </p>
<script>
$(document).ready(function(){
$("select").hide();
$("div#importFiles").hide();
});
$("input:radio").change(function(){
$("input:radio").each(function(){
var eachID = $(this).attr("rel");
$("#"+eachID).hide();
});
var relatedID = $(this).attr("rel");
$("#"+relatedID).show();
});
</script>
</body>
</html>
|
|
|
|
|
Date :
2012-11-19 16:01:13 |
By :
sakuraei |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
Load balance : Server 00
|