[thelist] IE javascript question
Stephen Rider
evolt_org at striderweb.com
Mon Jul 2 09:17:43 CDT 2007
You input only has a name, but in your script you're trying to call
it by ID. "Name" and "id" are two different attributes. I would
either call the element by Name or add the ID to the tag.
Stephen Rider
On Jul 2, 2007, at 9:04 AM, Eduardo Kienetz wrote:
> In my form I have this button:
> <input type="submit" name="submit2" value="ADD" class="formbranco"
> onClick="return verificaMarcacao('Please select at least one
> item!');">
>
> Which when clicked should check if at least one checkbox is checked,
> using this javascript function:
>
> function verificaMarcacao(msg){
> var i,tmp,ind,txt,sel;
> sel = document.getElementById('amostra').selectedIndex;
> for(i=0;i<examesmats[sel].length;i++){
> tmp = document.getElementById(examesmats[sel][i]);
> if(tmp.childNodes[0].childNodes[1].checked) return true;
> }
> alert(msg);
> return false;
> }
>
> I'm guessing this has something to do with childNodes, but I was
> unable to confirm (much less to tell why).
>
> Now, what happens is that even selecting a checkbox Internet Explorer
> shows the message.
>
> Should I use getElementByName? Is it okay (not deprecated, etc) ?
More information about the thelist
mailing list