<!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" xml:lang="en"> <head> <meta http-equiv="Content-Type" content="text/html;charset=gb2312" /> <title>表單提交到商務通后台 中文說明加換行的實現方法</title> <style type="text/css"> #yuyue {width:320px;margin:0 auto;} </style> </head> <body> <div id="yuyue"> <p>姓名: <input type="text" id="gname"></p> <p>年齡: <input type="text" id="gage"></p> <p>電話: <input type="text" id="gphone"></p> <p>留言: <textarea id="gmsg" cols="30" rows="4"></textarea></p> <p><input type="button" value="提交" onclick="submit_to_swt();"></p> </div> <script type="text/javascript"> function submit_to_swt(){ var name = document.getElementById("gname"); var age = document.getElementById("gage"); var phone = document.getElementById("gphone"); var msg = document.getElementById("gmsg"); if(name.value==""){ alert("請輸入您的姓名!"); name.focus(); return false; } if(age.value==""){ alert("請輸入您的年齡:!"); age.focus(); return false; } if(phone.value==""){ alert("請輸入您的電話!"); phone.focus(); return false; } if(msg.value==""){ alert("請輸入您的留言:!"); msg.focus(); return false; } if(typeof openZoosUrl != "undefined"){ openZoosUrl('chatwin','&e='+escape('姓名:'+name.value+'<br/>年齡:'+age.value+'<br/>電話:'+phone.value+'<br/>留言:'+msg.value)); } } </script> <!--測試請將此處商務通代碼替換為你的--> <script language="javascript" src="http://testserver.zoosnet.net/JS/LsJS.aspx?siteid=lza69557093&lng=cn"></script> <!--測試請將此處商務通代碼替換為你的--> </body> </html>
文章轉載於:http://www.120muban.com/code/swtcode/256.html