bubberz Posted August 25, 2005 Posted August 25, 2005 When I run the page, I get an "Object Expected" on line 16, which points to the asp:dropdownlist line in the HTML of the .aspx page. Here's the .js file: var keys; var timeStamp; timeStamp = new Date(); function dd_onkeypress(DropDownList1) { * var key = event.keyCode; * event.returnValue=false; *//a-z, A-Z, 0-9 * if ((key>=97 && key<=122) || (key>=65 && key<=90) || (key>=48 && key<=57)) { * ********key = String.fromCharCode(key); * ********var now = new Date(); * ********var diff = (now.getTime() - timeStamp.getTime()); * ********timeStamp = new Date(); * ********//1 seconds = 1000 milliseconds<BR>*** * ********if (diff > 1000) { * ********************keys = key;**** * *********************} else { * *********************keys = keys + key; * *********************} * *********************var cnt; * *********************//for (cnt=0;cnt<document.all(DropDownList1).children.length;cnt++) * *********************//for (cnt=0;cnt<DropDownList1.children.length;cnt++) * *********************for (cnt=0;cnt<DropDownList1.options.length;cnt++) { ********************** var itm = DropDownList1.options[cnt].text; ********************** if (itm.substring(0,keys.length).toLowerCase()==keys.toLowerCase()) * *********************{ * *********************//var itm = document.all(DropDownList1).children[cnt].text; * *********************//var itm = DropDownList1.children[cnt].text; * *********************//if (itm.substring(0,keys.length).toLowerCase()==keys.toLowerCase()) { //document.getElementById(DropDownList1).selectedIndex = cnt; DropDownList1.selectedIndex = cnt; break; } } } //document.all(DropDownList1).onchange(); } For the Page_Load in the .aspx.vb file I've got: DropDownList1.Attributes.Add("onkeyup", "javascript:return dd_onkeypress('DropDownList1');") Quote
mark007 Posted August 26, 2005 Posted August 26, 2005 Is this a javscript or asp.net error? Have you made sure your dropdown is declared? Quote Please check the Knowledge Base before you post. "Computers are useless. They can only give you answers." - Pablo Picasso The Code Net
bubberz Posted August 26, 2005 Author Posted August 26, 2005 Is this a javscript or asp.net error? Have you made sure your dropdown is declared? Well, if I comment out the Page_Load .aspx code that calls the .js file's function, then the page doesn't throw an error, and the dropdownlist acts as it should from the .NET toolbox Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.