|
Justin, Not to ask really dumb questions, but this is inside a properly formatted HTML document, right? What's confusing me is that the line number of the error is "0", and I'm not really sure how that can happen. When there is an object expected error it usually means that it couldn't find a variable in the JS or the DOM element (like a form or form field). I don't see a glaring problem right off, but what if document.cookie doesn't exist, would this still work? Here is an example of my cookie routine which only runs if the cookie exists... <script language="JavaScript"> <!-- function getCookie(the_info) { if (document.cookie){ var the_cookie = document.cookie; var the_cookie = unescape(the_cookie); var broken_cookie = the_cookie.split("="); var the_values = broken_cookie[1]; var separated_values = the_values.split("/"); var property_value = ""; for(loop = 0; loop < separated_values.length; loop++) { property_value = separated_values[loop]; var broken_info = property_value.split(":"); var the_property = broken_info[0]; var the_value = broken_info[1]; the_info[the_property] = the_value; } // do stuff var cookie_information = new Array(); getCookie(cookie_information); //--> </script> Joel R. Cochran Director of Internet Services VamaNet.com (800)480-8810 mailto:webmaster@vamanet.com > -----Original Message----- > From: Justin Houchin [mailto:jhouchin9@charter.net] > Sent: Tuesday, April 30, 2002 3:38 PM > To: web400@midrange.com > Subject: [WEB400] Having Problems with JavaScript > > > This is a multi-part message in MIME format. > -- > [ Picked text/plain from multipart/alternative ] > Joel I am getting this message when I click on the link to > execute the changeForm code:LIne 0 Error, Object Expected. > Here is my code: > > > <script language="javascript"> > var useridCookie = "useridCookie"; > // GetCookie() will return the data that is contained // > // in the cookie specified by the name pass in. // > > function GetCookie(name) { > var value = name + "="; > var i = 0; > while (i < document.cookie.length) { > var j = (i + value.length); > if (document.cookie.substring(i,j) == value) { > var len = document.cookie.indexOf(";",j); > if (len == -1) > len = document.cookie.length; > return unescape(document.cookie.substring(j, len)); > } > i = document.cookie.indexOf(" ", i) + 1; > if (i == 0) break; > } > return null; > } > function changeForm() { > GetCookie(useridCookie); > document.useridform.USERID.value = cookieValue; > document.useridform.submit() > } > </script> > > > > Here is my form: > > > <form name="useridform" method=GET action=/cgi-bin/iteminq> > <input type="hidden" name="XCAT" value="ACC"> > <input type="hidden" name="USERID" value="GUEST"> > </form> > > > Here is my a href code: > > <td height="11"><a href="javascript:changeForm()" > target="mainFrame"><img > src="Images/Clip%20Art/Accessories%20Button.gif" width="118" > height="26" border="0"></a></td> > > > Thanks again for all of your help!! > Thanks, > > Justin Houchin > Programmer > Reliatek, Inc > jhouchin9@charter.net > Thanks, > > > _______________________________________________ > This is the Web Enabling the AS400 / iSeries (WEB400) mailing list > To post a message email: WEB400@midrange.com > To subscribe, unsubscribe, or change list options, > visit: http://lists.midrange.com/cgi-bin/listinfo/web400 > or email: WEB400-request@midrange.com > Before posting, please take a moment to review the archives > at http://archive.midrange.com/web400. >
As an Amazon Associate we earn from qualifying purchases.
This mailing list archive is Copyright 1997-2024 by midrange.com and David Gibbs as a compilation work. Use of the archive is restricted to research of a business or technical nature. Any other uses are prohibited. Full details are available on our policy page. If you have questions about this, please contact [javascript protected email address].
Operating expenses for this site are earned using the Amazon Associate program and Google Adsense.