¥Ñ¤W±¤TÓ form ¨Ó¬Ý¡A¬Û«H§A¤£Ãøµoı¡A¹ê»Ú¤Wn¿ï¾Ü¶Ç°eªº¬O form membera
©M form memberb¡A¦Ü©ó form add «h¥u¬O´£¨Ñ¤@Ó¿ï¾Ü¼ÐÅÒ¡A¥H¤Î¤@Ӷǰeªí³æ«ö¶s
¦Ó¤w¡A¥»¨¥¦ªº¸ê®Æ¬O¤£°e¥X¥hªº¡C·í¨Ï¥ÎªÌ¦b form add «ö¤U Submit ¶s«á¡Aonclick
ªº Scriipt ³]©w·|Âà¦Ó°õ¦æ¤@Ó§Ú̳]pªº MultiFormSend() ¨ç¼Æ¡C¦b³oÓ¨ç¼Æ¤¤
§Ú̺¥ýn§PÂ_ªº´N¬OÂsÄýªÌ¿ï¾Üªº¬On¥[¤J¤@¯ë·|ûÁÙ¬Oª÷¥d·|û¡H¦]¦¹§ÚÌ¥i¥H
³o»ò¦w±Æ¡G
function MultiFormSend()
{
/* ªí³æ forms.add ¤¤ªº Radio ¿ï¶µ rd1 ¡A¬O¨Ñ¨Ï¥ÎªÌ³]©w¬O§_¥[¤Jª÷¥d·|û
ªº¿ï¶s¡A©Ò¥H¥ý¨ú¨äÈ¥[¥H§PÂ_n¶Ç°e¨ºÓªí³æ¡C */
var sender=document.forms.add;
var isvip=(sender.rd1[0].checked)?sender.rd1[0].value:sender.rd1[1].value;
/* ...... ¨ä¥L Script ±Ôz ...... */
}
§Ú̦b HTML ùئw±Æ forms.add ªº rd1[0] ȬO "yes"¡Ard1[1] ȬO "no"¡A¥ÎÅܼÆ
isvip ¨ú±o yes or no «á¡A´N¥i¥H¿ï¾Ün§â¨ºÓ form submit¡A¨Ò¦p¡G
function MultiFormSend()
{
/* ...... ¨ä¥L Script ±Ôz ...... */
/* ¦pªGÂsÄýªÌ¿ï§_¡A«h¥Î sendform Åܼưѷӷ|û°ò¥»¸ê®Æªí³æ¡C */
if (isvip=="no") {var sendform=document.forms.membera;}
else
/* ¦pªGÂsÄýªÌ¿ï¬O¡A«h¥Î sendform ÅܼưѷӪ÷¥d·|û¸ê®Æªí³æ¡C */
{var sendform=document.forms.memberb;}
/* §â³Q sendform °Ñ·Ó¨ìªºÅܼƥΠsubmit ¤èªk¡A±q Script ¤¤¶Ç°eªí³æ¡C */
sendform.submit();
}
ÁÙ¦³¤@ÂIn´£ªº´N¬O forms.memberb ¤¤¦³¤@°ï TYPE=HIDDEN ªº INPUT ¼ÐÅÒ³]©w¡A
¤Z¬O HIDDEN ªºªí³æ¤¸¥ó¡A³£¬OµLªk¦bºô¶Åã¥Ü¥X¨Óªº¡A¨º»ò§Ú̬°¤°»ò°µ³o¼Ëªº
¦w±Æ©O¡H¦]¬°ª÷¥d·|û©M¤@¯ë·|û¦b°ò¥»¸ê®Æ¤W¬O¤@¼Ëªº¡A¥u¬Oª÷¥d·|û¦h¤F id ©M
pass ¨âÓÄæ¦ì¡A©Ò¥HÁקK¨Ï¥ÎªÌ¿é¤J¨â¦¸¸ê®Æ¡A§Ú̧â©Ò¦³ forms.membera ªº¿é¤J
Äæ¦ì¦b forms.memberb ¤¤¥Î HIDDEN ¤]«O¯d¤@¥÷¡A¨ì¨Ï¥ÎªÌ¿ï¾Ü¥[¤Jª÷¥d·|û®É¡A
§Ú̦b§â°ò¥»·|ûªº¦U¶µ¿é¤J½Æ»s¨ìª÷¥d·|ûªº HIDDEN Äæ¦ìùØ¡A³o®É submit ¡A´N
¤£·|¥u°e id ©M pass ¨âÓÄæ¦ì¡A¦Ó¬O©Ò¦³°ò¥»·|ûÄæ¦ì¸ê®Æ¡A¥[¤W id ©M pass ¨â¶µ
¡C¦Ü©ó¨âÓ form ¤¤¦UÄæ¦ìȪº½Æ»s¡A§A¥i¥H¥Î¤U¦C¤è¦¡¡G
if (isvip=="no") {var sendform=document.forms.membera;}
else
/* basic °Ñ·Ó°ò¥»·|ûªí³æ¡Asendform °Ñ·Óª÷¥d·|ûªí³æ¡C
µM«á¤@Ó¤@Ó§â¬Û¹ïÀ³Äæ¦ìȱq membera ½Æ»s¨ì memberb¡C */
{var basic=document.forms.membera;
var sendform=document.forms.memberb;
sendform.name.value=basic.name.value;
sendform.area.value=basic.area.value;
sendform.age.value=basic.age.value;
sendform.sex.value=(basic.sex[0].checked)?basic.sex[0].value:basic.sex[1].value;}
¦n¤F¡A¸g¹L³o¼ËÅé¶Kªº³]p¡A¬J¤£·|¦³ªí³æÂø¶Ãªº·Pı(¨Æ¹ê¤WÂsÄýªÌ³£·|¿ùı¥L¥u¦b
¾Þ§@¤@Óªí³æ¦Ó¤w)¡A¦Ó¥BÂsÄýªÌ¬Ù¤U«Âпé¤J°Ê§@¡A§Aªº Web Server ¤]µ·²@¨Sº|±¼
¥²nªº°T®§¡C©Ò¥H¥Î Script ¾Þ§@ form.submit() ¡A¥i¤£¥u¥\¥Î¤@ÂIÂI³á¡C