日期:2014-05-16 浏览次数:20397 次
echo "<form name='shopping_cart_form' method='post' action='include/shopping_cart_form.php' onsubmit='return dosubmit()'>"; echo "<div id='item_details' style=''> <input class='txt_qty' type='text' name='textbox_qty' id='textbox_qty' /> <input class='add_button' type='submit' name='btn_add' id='btn_add' value='Add to Cart' /> </div>"; echo "</form>";
//无论我把这段js放在什么位置,都不起作用,为什么啊? <script language="javascript" type="text/javascript"> function dosubmit() { if(document.shopping_cart_form.textbox_qty.value=="" || document.shopping_cart_form.textbox_qty.value==0) { if(document.shopping_cart_form.btn_add.value=="Add to Cart") { document.shopping_cart_form.textbox_qty.style.borderColor="red"; alert("please fill all fields!"); return false; } } } </script>
echo "<form name='submit_form' method='post' action='order_confirmation.php' onsumbit='return isEmpty();'>"; //.... while(..){ echo "<td style='$time_style'><input type='radio' name='$dest_id_time' value='$pickup_time_id'$disable>$pickup_time_formatted</td>"; } echo "<tr><td style='font-size:11.5pt'><input type='radio' name='payment_methods' value='credit' >Pay by Whim Win Credit </td></tr>"; echo "<tr><td style='font-size:11.5pt'><input type='radio' name='payment_methods' value='card' >Credit / Debit Card / Paypal </td></tr>"; echo "</form>";
<script language="javascript"> //由于里面有个radio的名字是动态的,所以根浴网友提示,直接遍历所有radio,来判断没checked的选项,但是为什么不起作用啊!!!!????愁死我了 <!-- function isEmpty() { var input=document.getElementsByTagName("input"); for(i=0;i<input.length;i++) { if(input[i].type=="radio") { if(input[i].checked == false) alert('Please choose your pick up time and payment method.'); } } } //--> </script>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>无标题文档</title> </head> <body> <form name='submit_form' method='post' action='order_confirmation.php' onsubmit='return isEmpty();'> <tr> <td style='border-bottom:3px #4F8A2B solid; color:#6B6B6B'><input type='radio' name='2' value='1' > 11:30</td> <input type='hidden' name='final_invoice_id' value='8731'> <input type='hidden' name='order_time' value='2012-05-03 00:00:45'> <input type='hidden' name='pickup_date' value='03/05/2012'> <input type='hidden' name='display_total_price' value='24.40'>