Do elements with id "f1" and "pic" exist? Because it looks like that is what your javascript is trying to access - I don't see either in the "Html source" you included.
Probably better to just document.getElementById() - not sure how cross-browser compilant the "document.id" syntax is. -----Original Message----- From: [email protected] [mailto:[email protected]] On Behalf Of smashell Sent: Wednesday, October 21, 2009 12:02 AM To: [email protected] Subject: [Webtest] TypeError: Cannot set property "value" of undefined to "0" my canoo webtest version is R_1786 Posted: 15-Oct-2009 13:17 when I click a button it says: Details javascript errorTypeError: Cannot set property "value" of undefined to "0" line0 javascript sourcefunction () { [native code, arity=0] } failing linefunction () { javascript call stackTypeError: Cannot set property "value" of undefined to "0" at (onclick event for HtmlSubmitInput[<input type="submit" value="ok" class="b" onclick="document.f1.pic.value=1;document.f1.clk.value=0;" tabindex="2">] in http://www.mysite.com/) Html source: <input class="b" type="submit" tabindex="2" onclick="document.f1.pic.value=1;document.f1.clk.value=0;" value="进入词条"/> <script type="text/javascript">var options={onconfirm:function(D,A,H,C){var E=document.f1;E.pic.value=1;if(!G("sug_clk")){if(A>=0){var I=document.createElement("INPUT");I.type="hidden";I.name="clk";I.id="sug_clk";I.value=1;E.appendChild(I)}}else{if(A>=0){G("sug_clk").value=1}}if(!G("sug_rsp")){var B=document.createElement("INPUT");B.type="hidden";B.name="rsp";B.id="sug_rsp";B.value=A;E.appendChild(B)}else{G("sug_rsp").value=A}E.submit()},getData:function(B){if(navigator.cookieEnabled&&!getCookie("baikesug")){var C=document.f1;if(!G("sug_oq")){var D=document.createElement("INPUT");D.type="hidden";D.name="oq";D.id="sug_oq";D.value=B;C.appendChild(D)}else{G("sug_oq").value=B}var A=document.getElementById("baikeSugSc");if(A){document.body.removeChild(A)}var A=document.createElement("script");A.src="http://baike.sug.baidu.com/su?wd="+encodeURIComponent(B)+"&t="+(new Date()).getTime();A.id="baikeSugSc";document.body.appendChild(A)}},append_html:"<div class='sug_close'><a href='javascript:void(0)' onclick=baikeSug.close();sendStat('sugclose')>close</a></div>"};var baikeSug={};function suggestion(){if(!navigator.cookieEnabled){return false}if(!getCookie("baikesug")){baikeSug=baidu.suggestion.create(baidu.G("kw"),options);baikeSug.close=function(){baikeSug.hide();baidu.G("kw").setAttribute("autocomplete","on");setCookie("baikesug","1","","/",location.host.replace(/:\d+/,""))}}}suggestion();baidu.sug=function(D){if(!D){return }var C=[];for(var A=0;A<D.s.length;A++){var E={};E.input=B(D.s[A]);E.selection=D.s[A];C.push(E)}baikeSug.giveData(D.q,C);function B(I){var H=document.createElement("textarea");try{H.innerHTML=I}catch(F){H.value=I}return H.value}};</script> _______________________________________________ WebTest mailing list [email protected] http://lists.canoo.com/mailman/listinfo/webtest

