Page 1 of 1

Object expected error has me stumped

Posted: Thu Apr 10, 2003 10:51 am
by snowfruit
Okay the following code always throws up the Object expected error line 13, character 14 which is at the i < sizeof(... line

Code: Select all

function showmenu(x)
&#123;
document.write("<table border='1' width='100'><tr><td><select id='a' style='visibility: visible;'>" );
for(var i=0;i < sizeof(x); i++) document.write("<option>"+x&#1111;i]+"</option>" );
document.write("</select></td></tr></table>" );
&#125;
I can't for the life of me figure out why this is happening... anyone have any suggestions?

sizeOf

Posted: Thu Apr 10, 2003 4:00 pm
by phpScott
I couldn't find the sizeOf() function in javascript but I did find a .length property.

Try this

Code: Select all

function showmenu(x)
&#123;
document.write("<table border='1' width='100'><tr><td><select id='a' style='visibility: visible;'>" );
for(var i=0;i < x.length;  i++) document.write("<option>"+x&#1111;i]+"</option>" );
document.write("</select></td></tr></table>" );
&#125;
assuming that x is just an array of values.

phpScott