<html> <head> <title>ThaiCreate.Com Tutorial</title> </head> <? mysql_connect("localhost","root","1234") or die(mysql_error()); mysql_select_db("service_a"); ?> <script language="JavaScript"> function resutName(atm_id) { switch(atm_id) { <? $strSQL = "SELECT * FROM atmosphere ORDER BY atm_id ASC"; $objQuery = mysql_query($strSQL); while($objResult = mysql_fetch_array($objQuery)) { ?> case "<?=$objResult["atm_id"];?>": frmMain.txtName.value = "<?=$objResult["atm_id"];?>"; break; <? } ?> default: frmMain.txtName.value = ""; } } </script> <body> <form action="index.php" method="post" name="frmMain"> List Menu <select name="atm" OnChange="resutName(this.value);"> <option value=""><-- Please Select Item --></option> <? $strSQL = "SELECT * FROM atmosphere ORDER BY atm_id ASC"; $objQuery = mysql_query($strSQL); while($objResult = mysql_fetch_array($objQuery)) $atm_price = $objResult["atm_price"]; { ?> <option value="<?=$objResult["atm_id"];?>"><? echo $atm_name?></option> <? } ?> </select> <input name="atm_price" type="text" disabled="disabled" id="atm_price" value="<? echo number_format($atm_price,2) ?>" size="10" /> <input name="atm_price" type="hidden" id="atm_price" value="<? echo $atm_price?>" /></form> </body> </html> <? mysql_close(); ?> <script language="JavaScript"> function resutName(CusID) { switch(atm_id) { frmMain.txtName.value = ""; } } </script>
<form name="frmMain"> <table> <tr> <td> <select name="atm" onchange="resutName(this)"> <option value="" atm_price="" atm_price_sh="">กรุณาเลือก</option> <option value="1" atm_price="5000" atm_price_sh="50,000.00">xxxxxx</option> <option value="2" atm_price="6000" atm_price_sh="60,000.00">yyyyyy</option> <option value="3" atm_price="7000" atm_price_sh="70,000.00">zzzzzzz</option> </select> </td> <td> <input name="atm_price_sh" type="text" disabled="disabled" id="atm_price_sh" value="<? echo number_format($atm_price,2) ?>" size="10" /> <input name="atm_price" type="hidden" id="atm_price" value="<? echo $atm_price?>" /> </td> </tr> </table> </form> <script> function resutName(obj){ document.frmMain.atm_price.value=obj.options[obj.selectedIndex].getAttribute("atm_price"); document.frmMain.atm_price_sh.value=obj.options[obj.selectedIndex].getAttribute("atm_price_sh") } </script>
เพื่อความปลอดภัยของเว็บบอร์ด ไม่อนุญาติให้แทรก แท็ก [img]....[/img] โดยการอัพโหลดไฟล์รูปจากที่อื่น เช่นเว็บไซต์ ฟรีอัพโหลดต่าง ๆ อัพโหลดแทรกรูปภาพ ให้ใช้บริการอัพโหลดไฟล์ของไทยครีเอท และตัดรูปภาพให้พอดีกับสกรีน เพื่อความโหลดเร็วและไฟล์ไม่ถูกลบทิ้ง