对象预期;找不到它。需要另一双眼睛。 [英] Object expected; can't find it. Need another pair of eyes.
问题描述
在下面的函数中,我不断得到一个''对象预期在第75行
char 5''但是对于我的生活我找不到错误。也许有人会这样亲戚看看他们的亲戚吗?我在
函数中指出了下面的问题行。
函数checkEmail(f){
//检查有效的电子邮件地址
var field = f;
// alert(field.value);
var str = field.value;
if(str ==""){
errors + =" [" + field.name.toUpperCase()+"如果(str!=""){
//如果浏览器支持window.RegExp <,则为een verplicht veld。\ n" ;;
} br />
if(window.RegExp){
var reg1str ="(@。* @)|(\\.\\。)|(@ \\ \\\。)|(\\。@)|(^ \\。)" ;;
var reg2str =
" ^。+ \\ @(\\ [?)[A-ZA-Z0-9\\-\\。] + \\。([A-ZA-Z] {2,3 } | [0-9] {1,3})(\\)?)$" ;;
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if(!reg1.test(str)&& reg2.test(str)){
// emailadress is正确
返回true;
}否则{
errors + =" [" + str +" ]是eju onjuist emailadres。\ n" ;;
/////////////////////////////// ///////////////这是支持A
问题
返回false;
}
//如果浏览器不支持window.RegExp
} else {
if(str.indexOf(" @)] > = 0){
errors + =" [" + str +" ]是eju onjuist emailadres.\
" ;;
}
}
}
}
感谢您借鉴我的眼睛和智慧。
John
-
------------------------------------------- ---------------------------------
--------- -
资源
http://groups.google.com/advanced_gr..._ugroup=*flash
------------------ -------------------------------------------------- --------
-----------
指南
www.laiverd.com
Flash& PHP Emailform
在Flash中使用textfiles
---------------------------- ------------------------------------------------ <无线电通信/>
-----------
" ;;
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if(!reg1.test(str)&& reg2.test( str)){
//电子邮件地址是正确的
返回true;
}否则{
errors + = [ + str +" ]是eju onjuist emailadres。\ n" ;;
/////////////////////////////// ///////////////这是支持A
问题
返回false;
}
//如果浏览器不支持window.RegExp
} else {
if(str.indexOf(" @)] > = 0){
errors + =" [" + str +" ]是eju onjuist emailadres.\
" ;;
}
}
}
}
感谢您借鉴我的眼睛和智慧。
John
-
------------------------------------------- ---------------------------------
--------- -
资源
http://groups.google.com/advanced_gr..._ugroup=*flash
------------------ -------------------------------------------------- --------
-----------
指南
www.laiverd.com
Flash& PHP Emailform
在Flash中使用textfiles
---------------------------- ------------------------------------------------ <无线电通信/>
-----------
文章< 41 ************* *********@dreader2.news.tiscali.nl>,
sh ****************** @ someserver.com 启发我们...在以下函数我不断得到一个''对象预期在第75行
char 5''但是对于我的生活我找不到错误。也许有人会这么亲戚看看?我在
函数中指出了下面的问题行。
函数checkEmail(f){
你永远不会验证代码调用此函数实际上传递了一个
非空字符串。
你应该这样做只是为了更稳定的代码。
//检查一个有效的电子邮件地址
var field = f;
// alert(field.value);
var str = field.value;
看,如果有人通过了你的空对象,就不会有价值。这将是
错误输出。
if(str ==""){
errors + =" [" + field.name.toUpperCase()+"是een verplicht veld.\ n;
你做了一个concat(+ =),但我没有看到错误。任何地方定义它是全球的b $ b吗?如果没有,你需要在这个函数的开头使用
var errors ="" ;;
。
} else {
errors + =" [" + str +" ]是eju onjuist emailadres。\ n" ;;
/////////////////////////////////// ///////////这是支持的问题
见上文关于变量错误的内容。 />
-
-
~kaeli~
同义词:你用的单词代替单词你可以'$
咒语。
http:// www .ipwebdesign.net / wildAtHeart
http://www.ipwebdesign。 net / kaelisSpace
2004年8月5日星期四14:29:45 +0200,Laiverd.COM写道:
< blockquote class =post_quotes>在下面的函数中我继续得到一个''对象预期在第75行
char 5''但是对于我的生活我找不到错误。
您是否发现过发布错误消息
提到嵌入在
$ b中的脚本的''第75行' $ b 58的帖子用的不多?
感谢您借鉴我的眼睛和智慧。
我建议你提供一个URL *,除非你是否足够幸运地拥有一个敏锐的眼睛
Javascript guru'发现错误。
*< http://www.physci.org/codes/sscce.jsp>
[请注意,尽管该文档的目标更多是在Java程序员身上,但b $ b; b相同的原则适用于
调试Javascripts,HTML& CSS格式..]
-
Andrew Thompson
http://www.PhySci.org/ 开源软件套件
http://www.PhySci.org/codes/ Web& IT帮助
http://www.1point1C.org/ Science&技术
Hi, In the following function I keep getting a ''Object expected at line 75
char 5'' but for the life of me I cannot find the error. Maybe someone would
be so kin to have a look? I indicated the ''problem'' line below in the
function.
function checkEmail(f){
// check for a valid emailadress
var field = f;
// alert(field.value);
var str = field.value;
if (str == ""){
errors += "[ " + field.name.toUpperCase() + " ] is een verplicht veld.\n";
} else if (str != "") {
// if the browser supports window.RegExp
if (window.RegExp) {
var reg1str = "(@.*@)|(\\.\\.)|(@\\.)|(\\.@)|(^\\.)";
var reg2str =
"^.+\\@(\\[?)[a-zA-Z0-9\\-\\.]+\\.([a-zA-Z]{2,3}|[0-9]{1,3})(\\]?)$";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if (!reg1.test(str) && reg2.test(str)){
// emailadress is correct
return true;
} else {
errors += "[ " + str + " ] is een onjuist emailadres.\n";
////////////////////////////////////////////// THIS IS SUPPOSED TO BE A
PROBLEM
return false;
}
// if the browser does not support window.RegExp
} else {
if(str.indexOf("@") >= 0){
errors += "[ " + str + " ] is een onjuist emailadres.\n";
}
}
}
}
Thanks for lending me your eyes and wisdom.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_gr..._ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
";
var reg1 = new RegExp(reg1str);
var reg2 = new RegExp(reg2str);
if (!reg1.test(str) && reg2.test(str)){
// emailadress is correct
return true;
} else {
errors += "[ " + str + " ] is een onjuist emailadres.\n";
////////////////////////////////////////////// THIS IS SUPPOSED TO BE A
PROBLEM
return false;
}
// if the browser does not support window.RegExp
} else {
if(str.indexOf("@") >= 0){
errors += "[ " + str + " ] is een onjuist emailadres.\n";
}
}
}
}
Thanks for lending me your eyes and wisdom.
John
--
----------------------------------------------------------------------------
-----------
RESOURCES
http://groups.google.com/advanced_gr..._ugroup=*flash
----------------------------------------------------------------------------
-----------
TUTORIALS at
www.laiverd.com
Flash & PHP Emailform
Using textfiles in Flash
----------------------------------------------------------------------------
-----------
In article <41**********************@dreader2.news.tiscali.nl >,
sh******************@someserver.com enlightened us with...Hi, In the following function I keep getting a ''Object expected at line 75
char 5'' but for the life of me I cannot find the error. Maybe someone would
be so kin to have a look? I indicated the ''problem'' line below in the
function.
function checkEmail(f){
You never verify that the code that calls this function actually passes a
non-null string.
You should do that just for more stable code.
// check for a valid emailadress
var field = f;
// alert(field.value);
var str = field.value;
See, if someone passes you a null object, there won''t be a value. This will
error out.
if (str == ""){
errors += "[ " + field.name.toUpperCase() + " ] is een verplicht veld.\n";
You do a concat ("+="), but I don''t see "errors" defined anywhere. Is it
global? If not, you need
var errors = "";
at the beginning of this function.
} else {
errors += "[ " + str + " ] is een onjuist emailadres.\n";
////////////////////////////////////////////// THIS IS SUPPOSED TO BE A
PROBLEM
See above about the variable "errors".
--
--
~kaeli~
Synonym: the word you use in place of a word you can''t
spell.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace
On Thu, 5 Aug 2004 14:29:45 +0200, Laiverd.COM wrote:
Hi, In the following function I keep getting a ''Object expected at line 75
char 5'' but for the life of me I cannot find the error.
Did it occur to you that posting an error message
that mentions ''line 75'' of a script embedded in a
58 line post is not that much use?
Thanks for lending me your eyes and wisdom.
I suggest you supply an URL*, unless you are
lucky enough to have one of the keen-eyed
Javascript guru''s spot the error.
* <http://www.physci.org/codes/sscce.jsp>
[ Note that although that document is aimed more
at Java programmers, the same principles apply to
debugging Javascripts, HTML & CSS formatting.. ]
--
Andrew Thompson
http://www.PhySci.org/ Open-source software suite
http://www.PhySci.org/codes/ Web & IT Help
http://www.1point1C.org/ Science & Technology
这篇关于对象预期;找不到它。需要另一双眼睛。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!