Jump to content

Affecting gadget state on a web page


Yesideez

Recommended Posts

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.

Link to comment
https://forums.phpfreaks.com/topic/79077-affecting-gadget-state-on-a-web-page/
Share on other sites

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.

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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.