0
您好我有我的網頁上輸入:有問題傳遞一個正則表達式,通過一種方法:
onclick="return tagList.addTag(true,'/^[a-zA-Z0-9._-][email protected][a-zA-Z0-9.-]+\.[a-zA-Z]{2,4}$/')"
然後我有想通過正則表達式的一些代碼.......
//get the value from the textbox
var _tagObject = document.getElementById('txt_newTag');
//validate the contents
validateEmail(_tagObject.value,validationExpression);
function validateEmail(stringToValidateArg,validationExpressionArg)
{
return validationExpressionArg.test(stringToValidateArg);
}
然而,這並不工作,我得到了以下錯誤消息:
Webpage error details User Agent: Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1; Trident/4.0; SLCC2; .NET CLR 2.0.50727; .NET CLR 3.5.30729; .NET CLR 3.0.30729; Media Center PC 6.0; InfoPath.2; Tablet PC 2.0) Timestamp: Tue, 8 Jun 2010 13:44:03 UTC Message: Object doesn't support this property or method Line: 101 Char: 5 Code: 0 URI: http://server.com/shared/scripts/tag-list.js
有誰知道我不能THR傳ough從頁面上的html元素像我有正則表達式?
任何幫助非常讚賞相當新的JavaScript編程....
皮特
+1首先:-) – 2010-06-08 14:09:28
你不但不需要它們,但它使用它們的直接錯誤 – 2010-06-08 14:47:38