Yesideez Posted November 27, 2007 Share Posted November 27, 2007 Just a little puzzled on this one. Say I've got a page and the only thing on it is a load of gadgets. A couple checkboxes and a string gadget. I've not defined a form or a table yet when one of the checkboxes is ticked the string gadget is enabled. When it's unticked the string gadget is disabled. This I can imagine would be pretty simply. Now let's place the gadgets inside a form - do I have to give it a name to be able to access the gadgets within Javascript? Also, if I use a table do I have to give that a name to access it as above? eg. document.myform.mytable.mystringgadget Or can I still access the string gadget like this: document.mystringgadget I know and understand about nested objects (ie. a table inside a form may need to be accessed form first) but I can't get my head around when I have to name elements and include them in a document statement and when I don't. Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 28, 2007 Share Posted November 28, 2007 you can get around the form by doing it like this: document.getElementById('myGadgetsIDHere').dosomethinghere = whatever; give you gadget an id - example above would be "myGadgetsIDHere"; of course you would change that, obviously, to whatever you want the id to be. Quote Link to comment Share on other sites More sharing options...
Yesideez Posted November 28, 2007 Author Share Posted November 28, 2007 Thanks for that. Unfortunately because JavaScript doesn't produce any error messages or even any codes its really difficult to debug. Is there an add-on for Forefox or some other third party piece of software to help writing JavaScript? I bought a small JavaScript pocket reference book but its been as useful as a chocolate teapot! Quote Link to comment Share on other sites More sharing options...
phpQuestioner Posted November 28, 2007 Share Posted November 28, 2007 FireBug will help you find errors in your scripts. It's an add on from FireFox; it can be found here: https://addons.mozilla.org/en-US/firefox/addon/1843 Quote Link to comment Share on other sites More sharing options...
Yesideez Posted November 28, 2007 Author Share Posted November 28, 2007 Wow I'm impressed with Firebug! Thanks for that, never realised something like that was available - definitely added to my faves Quote Link to comment Share on other sites More sharing options...
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.