...

View Full Version : listbox filling failure



registered_memb
05-23-2005, 10:27 PM
Hi,

Can somebody help me about following script.
(JS error: 'undefined' is null or not an object)


<html>

<head>

<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>New Page 1</title>
<script language="JavaScript1.1">
<!--
expDate= new Date();
expDate.setDate(expDate.getDate() + 1);
// Public domain cookie code written by:
// Bill Dortch, hIdaho Design (bdortch@netw.com)
function SetCookie(name,value,xDate) {
var argv = SetCookie.arguments;
var argc = SetCookie.arguments.length;
var expires = (argc > 2) ? argv[2] : null;
var path = (argc > 3) ? argv[3] : null;
var domain = (argc > 4) ? argv[4] : null;
var secure = (argc > 5) ? argv[5] : false;
document.cookie = name + "=" + escape(value) +
((expires == null) ? "" : ("; expires=" + expires.toGMTString())) +
((path == null) ? "" : ("; path=" + path)) +
((domain == null) ? "" : ("; domain=" + domain)) +
((secure == true) ? "; secure" : "");
}

function GetCookie(name) {
var arg = name + "=";
var alen = arg.length;
var clen = document.cookie.length;
var i = 0;
while (i < clen) {
var j = i + alen;
if (document.cookie.substring(i,j) == arg) {
return getCookieVal(j);
}
i = document.cookie.indexOf(" ", i) + 1;
if (i == 0) break;
}
return null;
}

function getCookieVal(offset) {
var endstr = document.cookie.indexOf(";", offset);
if (endstr == -1) {
endstr = document.cookie.length;
}
return unescape(document.cookie.substring(offset, endstr));
}
// End of Bill Dortch's Public Domain Cookie Code


function fillList() {
x=GetCookie("cookie_1");
if(x!=null) {
var arrPrevOrd= x.split("*");

j=arrPrevOrd.length;
for(i=0; i<j; i++) {
document.form1.select1.options[i].text=arrPrevOrd[i];
}
}
}


function readList(selectX) {
str="";
elemNm= selectX.options.length;
for(i=0; i<elemNm; i++) {
if(selectX.options[i].text != "&") //drop empty(&) row
str+= "*"+selectX.options[i].text;
}
return str;
}


function deleteRow() {
sel= document.form1.select1.selectedIndex;
document.form1.select1.options[sel].text="&"; //empty mark

SetCookie("cookie_1", readList(document.form1.select1), expDate);

}


function inputF() {
var inputVal= document.form1.text1.text;
var newArr= inputVal.split("*");

for(i=0; i<newArr.length; i++) {
document.form1.select1.options[i].text=newArr[i];
}
SetCookie("cookie_1", inputVal, expDate);
}
-->
</script>
</head>

<body onLoad="fillList()">

<form name="form1" method="POST" action="--WEBBOT-SELF--" onSubmit="location.href='_derived/nortbots.htm';return false;" webbot-onSubmit>
<!--webbot bot="SaveResults" u-file="_private/form_results.csv" s-format="TEXT/CSV" s-label-fields="TRUE" startspan --><input TYPE="hidden" NAME="VTI-GROUP" VALUE="0"><!--webbot bot="SaveResults" endspan i-checksum="43374" --><p>
<input name="text1" type="text" size="59" value="1111">&nbsp;&nbsp;
<input onClick="inputF()" type="button" value="Input" name="B3">&nbsp;&nbsp;
'*' as delimiter</p>
<p>
&nbsp;</p>
<p>
<select name="select1" size="5" style="width: 300; font-family:Times New Roman; font-size:10pt">
<option selected>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
<option>&</option>
</select></p>
<p><input onClick="deleteRow()" type="button" value="Delete" name="B2">&nbsp; highlited row</p>
</form>

</body>

</html>



Thanks

glenngv
05-24-2005, 06:13 AM
function inputF() {
var inputVal= document.form1.text1.text;

Change .text to .value



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum