<html> <head> <title></title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <script type="text/javascript"> function ck_frm(){ // ซ่อน/โชว์ รายละเอียด solution checkbox var ck = document.getElementById('ckk'); if(ck.checked == true){ document.getElementById('detailsolution').style.display = ""; }else{ document.getElementById('detailsolution').style.display = "none"; } } </script> </head> <body> <form name="presaleRFQ" method="POST" action="#"> <table border="0" border-color="#000" width="100%" height="50"> <label>Solution:</label> <?php include 'Connection.php'; $sqlSolution = "SELECT * FROM dbo.TISS_SOLUTIONMS" ; $querySolution = sqlsrv_query($Conn,$sqlSolution); while($result = sqlsrv_fetch_array($querySolution)){ $solutionname = $result['solution_name']; $ref1 = $result['solution_ref1']; $ref2 = $result['solution_ref2']; $ref3 = $result['solution_ref3']; $ref4 = $result['solution_ref4']; $ref5 = $result['solution_ref5']; ?> <tr> <td> <div> <input type="checkbox" name="ckk" id="ckk" onClick="ck_frm();" /> <label size="2px" font-weight="bold"><?php echo $solutionname;?></label><br/> </div> </td> </tr> <tr> <td name="detailsolution" id="detailsolution" style="display:none;"> <div style="margin:0 0 0px 20px;"> <table> <tr> <td><font size="2px"><?php echo $ref1;?></font></td> <td><input type="text"/></td> </tr> <tr> <td><font size="2px"><?php echo $ref2;?></font></td> <td><input type="text" /></td> </tr> <tr> <td><font size="2px"><?php echo $ref3;?></font></td> <td><input type="text"/></td> </tr> <tr> <td><font size="2px"><?php echo $ref4;?></font></td> <td><input type="text"/></td> </tr> </table> </div> </td> </tr> <?php } ?> </table> </form> </body> </html>
function ck_frm(index){ // รับ index เข้ามา var ck = document.getElementById('ckk'+index); if(ck.checked == true){ document.getElementById('detailsolution'+index).style.display = ""; }else{ document.getElementById('detailsolution'+index).style.display = "none"; } }
<input type="checkbox" name="ckk" id="ckk" onClick="ck_frm(<?=$i?>);" /> // checkbox <td name="detailsolution" id="detailsolution<?=$i?>" style="display:none;" //element
<?php include 'Connection.php'; $sqlSolution = "SELECT * FROM dbo.TISS_SOLUTIONMS" ; $params = array(); $options = array( "Scrollable" => SQLSRV_CURSOR_KEYSET ); $querySolution = sqlsrv_query($Conn,$sqlSolution, $params, $options); $numrow = sqlsrv_num_rows($querySolution); $i=0; while($i<$numrow) { $result = sqlsrv_fetch_array($querySolution); $solutionname = $result['solution_name']; $ref1 = $result['solution_ref1']; $ref2 = $result['solution_ref2']; $ref3 = $result['solution_ref3']; $ref4 = $result['solution_ref4']; $ref5 = $result['solution_ref5']; ?> <tr> <td> <div style="margin:0 0 0px 120px;font-weight:bold;"> <input type="checkbox" name="ckk" id="ckk" onClick="ck_frm(<?php echo $i?>);" /> <label size="2px" font-weight="bold"><?php echo $solutionname;?></label><br/> </div> </td> </tr> <tr> <td name="detailsolution" id="detailsolution<?php echo $i?>" style="display:none;"> <div style="margin:0 0 0px 150px;"> <table> <tr> <td><font size="2px"><?php echo $ref1;?></font></td> <td><input name="frm_txt" id="frm_txt" class="loginform_detailsoln" /></td> </tr> <tr> <td><font size="2px"><?php echo $ref2;?></font></td> <td><input type="file" name="ckk" id="ckk" class="loginform_detailsoln"/></td> </tr> <tr> <td><font size="2px"><?php echo $ref3;?></font></td> <td><input name="ckk" id="ckk" class="loginform_detailsoln"/></td> </tr> <tr> <td><font size="2px"><?php echo $ref4;?></font></td> <td><input name="ckk" id="ckk" class="loginform_detailsoln"/></td> </tr> </table> </div> </td> </tr> <?php $i++;} ?>
//บรรทัดที่ 25 input type="checkbox" name="ckk" id="ckk<?php echo $i?>" onClick="ck_frm(<?php echo $i?>);" />
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง