Object expected error has me stumped

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
snowfruit
Forum Newbie
Posts: 1
Joined: Thu Apr 10, 2003 10:51 am

Object expected error has me stumped

Post 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?
User avatar
phpScott
DevNet Resident
Posts: 1206
Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.

sizeOf

Post 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
Post Reply