|
|
 |
Re: FN-FORUM: Check box problem
date posted 19th March 2008 00:07
>>>> How do you check if a Check Box exists using Javascript before you
>>>> test if it is checked?
>>>>
>>>> if (document.getElementById("ALL_Diaries") == true) {
>>>>
>>>>
>>>> }
>>>>
>>>> doesn't work
>>>>
>>> I haven't had the time to learn Javascript yet but I suspect if the
>>> element isn't found a null value will be returned.
>>>
>>> Try something like:
>>>
>>> if (document.getElementById("ALL_Diaries") != null) {
>>>
>>>
>>> }
>>>
>>> HTH
>>> James
>>>
>>>
>>>
>>
>> They were all null even if they existed when I tried - Pam
> Like I said my Javascript knowledge is very limited (goes as far as
> copying and pasting off hotscripts etc.) but a check on google brings
> up this page
> http://developer.mozilla.org/en/docs/DOM:document.getElementById
>
> Looking under the 'Notes' heading it says that the function will
> return null if no element with that id exists.
>
> The only thing I can think of is that different browsers interpret
> Javascript differently. The above reference is for Mozilla - what
> browser are you using?
>
> James
>
I've just found this - http://www.thescripts.com/forum/thread90845.html
Sounds like a solution to your problem and it also gives a pretty good
explanation as to what is going on.
Hopefully that should work.
James
|
 |
|