/    Sign up×
Community /Pin to ProfileBookmark

object "has no properties" – several fixes don’t apply

Hi

I have created a series of checkboxes using an iterative loop. The first checkbox has a “check/uncheck all” function which gives the error “box has no properties” on line 13) in Firefox 1.0.6 and IE 6.0. Most of the code pieces that I have seen do not allow for the number of checkboxes to be determined on the fly, and many want all checkboxes to have the same name, which is pointless!

The code is at [url]http://www.brilliantweb.co.za/code.html[/url]

All help gratefully accepted.

Brendon

to post a comment
JavaScript

2 Comments(s)

Copy linkTweet thisAlerts:
@David_HarrisonSep 23.2005 — Change this:for (var i = 0; i <= trib_on.length; i++) {To this:for (var i = 0; i < trib_on.length; i++) {You're running for 1 more checkbox than you have so you get an error on the last iteration.

I'm kinda tired right not so I'm afraid I'm gonna have to blunt here, your HTML sucks, also in the JavaScript you randomly open a <tr> without first closing the one that's already open, and then you don't close it. Why are you using tables in the first place anyway? I guess an aruguement could be made that you have a form of tabluar data, but then you don't put any table headers in so it's clear that you're just using it for presentaional purposes because you happen to like the default way it is rendered in graphical browsers.

If anything it would be better to write the first "check all" checkbox with JavaScript, since only users with JavaScript will be able to use it, but write the other checkboxes out in the HTML so that users without JavaScript can still fill out the form.

I apologise for being rude about your HTML.
Copy linkTweet thisAlerts:
@brendonhatcherauthorSep 26.2005 — Hi David

Thanks for the info. Your code change worked!

With regard to the HTML presentation, you are absolutely right. I am bound by a confidentiality agreement, so I can't give the full details, but... This is a web page that will run on an embedded microchip with a custom-built web server. I extracted the example from a much larger block of code. The code errors result from this extraction, and the poor coding results from the very specific development contraints that we are required to comply with.

Thanks again for the input.

Regards

Brendon
×

Success!

Help @brendonhatcher spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 5.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @AriseFacilitySolutions09,
tipped: article
amount: 1000 SATS,

tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,
)...