| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 854 人关注过本帖
标题:求助! 这个程序好像没调用.
只看楼主 加入收藏
tary
Rank: 1
等 级:新手上路
帖 子:780
专家分:0
注 册:2004-10-5
收藏
 问题点数:0 回复次数:3 
求助! 这个程序好像没调用.

<html> <head> <title>order from example</title> <script language="javascript"> <!-- hide this script from non-javascript-enbled browsers function isANumber(inputvalue){ var result=true if(! parseFloat(inputvalue){ result=false } else{ for(var i=0;i<=inputvalue.length;i++) if(inputvalue.charAt(i)=" "){ if(! parseFloat(inputvalue.charAt(i))){ result=false break } } } }

return result }

function isAvalidE-mail(inputvalue){ var foundAt=flase var foundDot=false for(var i=0;i<=inputvalue.length;i++){ if(inputvalue.charAt(i)=="@"){ foundAt=true } } if(foundAt&&foundDot){ return true } else { return false } }

function isAvalidPhoneNumber(inputvalue){ var digitsfound=0 for(var i=0;i<=inputvalue.length;i++){ if(isANumber(inptvalue.charAt(i))){ digitsfound++ } } if(digitsfound>=10){ return true } else{ return false} }

function exists(inputvalue){ var aCharExists=false for(var i=0;i<=inputvalue.length;i++){

if(inputvalue.chatAt(i)!=" " && inputvalue.chatAt(i)!= ""){ aCharExists=true break } } return aCharExists }

function validateform(){ var rc=true if(!document.quoteForm.designChoice.checked&& !document.quoteForm.mainChoice.checked&& !document.quoteForm.promoChoice.checked){ alert("please check whether yuou're interested in our design,maintenancem, or promotion services so we can give you a more accurate quote. thanks!") rc=false }

if(document.quoteForm.bizChoice[1].checked){ if(!document.quoteForm.corpName.value){ alert("you've specified that you're an employee, so could you please type in the name of the company you work for?thanks!") rc=false } } if(!document.quoteForm.firstName.value||!document.quoteForm.lastName.value){ alert("please type inyour entire name(both first and last). thanks!") rc=false } if(!document.quoteForm.E-mailChoice.checked&&!document.quoteForm.phoneChoice.checked){ alert("please let us know whether you'd like us to contact you by E-mail or by phone thanks!") rc=false } if(document.quoteForm.E-mailChoice.checked&& !isAvalidE-mail(document.quoteForm.E-mailAddr.value)){ alert("we can't contact you via E-mail unless you give us a valid E-mail address. thanks!") rc=false } else{ if(document.quoteForm.phoneChoice.checked&& !isAvalidPhoneNumber(document.quoteForm.phoneNumber.value)){ alert("we can't contact you via phone unless you give us your phone number(make sure to include you are code). thanks!") rc=false } } if(rc){ alert("thanks! we'll contact you with q quote shortly.") } return rc } //--> </script> </head> <body> <h1> order form examples</h1> <hr> <p> <hr> <table width="100%" cellspacing="10" cellpadding="10" border=0> <tr> <td> <font face="Helvetica.Arial,Verdana" size="2"> <form name="quoteForm" onSubmit="return validateform();"> <p> <b> whick of ous services are you interested in?</b> (check all that apply.) <p> Website design<input type="checkbox" name="designChoice" value="design" > &nbsp;&nbsp;&nbsp;&nbsp; Website maintenance <input type="checkbox" name="mainChoice" value="maint"> &nbsp;&nbsp;&nbsp;&nbsp; Online promotion <input type="checkbox" name="promoChoice" value="promo"> <p> <b>why do you want a website? (or, if you already have one ,what do you use it for?)</b> <p> <textarea name="purpose" cols="60" rows="5" wrap="virtual"> </textarea> <p> <b> do you want to incorporate photos into your site?</b> <br> yes <input type="radio" name="pixChoice" value="hasPix" checked> no <input type="radio" name="pixChoice" value="hasNoPix"> <p> <b> do you have one or more products you'd like to promote/ sell on you site?</b> <br> yes <input type="radio" name="cdChoice" value="hasProducts" checked> no <input type="radio" name="cdChoice" value="hasNoProducts"> <p> <b> are you a small businesss owner,or do you work for a large corporation?</b> <br> samll business owner <input type="radio" name="bizChoice" value="isOwner" checked> employee <input type="radio" name="bizChoice" value="isEmployee"> <p> <b> if you work for a corporation,what's the name?</b> <input type="text" name="corpName" size="25"> <p> <b> is there anything else you think we need to know in order to give you an accurate price quote?</b> <p> <textarea name="extrainfo" cols="60" rows="5" wrap="virtual"> </textarea> <p>

<table> <tr> <td> <font face="Helvetica, Arial,Verdana" size="2"> <b> you first name:</b> </td> <td> <font face="Helvetrica, Arial,Verdana" size="2"> <b> last name:</b> </td> </tr> <tr> <td> <input type="text" name="firstname" size="25" onBlur="if(!exists(this.value)){ alert('please enter a first name');}"> </td> <td> <input type="text" name="lastname" size="25" onBlur="if(!exists(this.value)){ alert('please enter a last name');}"> </td> </tr> <tr> </tr>

<tr> <td colspan="2"> <font face="Helevetica,Arial,Verdana"size="2"> <b> how would you like us to contact you(E-mail,phone,or both)?</b> </font> </td> </tr>

<tr> <td align="right"> <font face="Helvetica,Arial,Verdana"size="35"> E-mail<input type="checkbox" name="E-mailChoice"value="E-mail"> </font> </td>

<td> <input type="text" name="E-mailAddr" size="35"> </td> </tr> <tr> <td align="right"> <font face="Helvetica,Arial,Verdana"size="2"> telephone<input type="checkbox" name="phoneChoice" value="phone"> </td> <td> <input type="text" name="phoneNumber" size="15"> </td> </tr> </table> <p> <center> <input type="submit" value="submit you quote request"> &nbsp;&nbsp;&nbsp;&nbsp;<input type="reset" value="clear the form"> </center> </body> </html>

就是在上面<head>和</head>中的函数,在<body></body>中没调用, 无任何结果.

[此贴子已经被作者于2005-4-18 15:59:06编辑过]

搜索更多相关主题的帖子: javascript html function example return 
2005-04-18 15:57
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 
代码好多啊

能不能少点啊?

2005-04-18 22:24
tary
Rank: 1
等 级:新手上路
帖 子:780
专家分:0
注 册:2004-10-5
收藏
得分:0 
&lt;form name="quoteForm" onSubmit="return validateform();"&gt;看一下这句, 有没有错. 这应该是调用了.

┌→¨ ≮我可以学会对你很冷落≯¨←┐ │  <却学不╓══╦══╖会将爱> │ │¨←┐ ╭╩╮哭‖哭╭╩╮ ┌→¨│ └──┘收 ╲╱ ◇‖◇ ╲╱回└──┘
2005-04-19 12:05
bingxue2332
Rank: 3Rank: 3
等 级:新手上路
威 望:6
帖 子:446
专家分:0
注 册:2004-11-6
收藏
得分:0 
你是说你的检测代码没有起到作用就过去了

2005-04-24 07:34
快速回复:求助! 这个程序好像没调用.
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.014570 second(s), 8 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved