Re: accessing dynamic generated dom element with javascript in IE

"John M. Hann" <[email protected]>
Newsgroups gmane.comp.web.dom.wdf
Message-ID <[email protected]>
Hi Sleeping Beauty,

Change

if ((q = myform.elements["Q_" + i]))

to

if ((q == myform.elements["Q_" + i]))

Note: double-equal ("==")

-- John

http://e-numera.com/ 

--- In [email protected], "Sleeping Beauty" <ms_f_habib@y...> wrote:
>
> I a creating a site for entering tests
> the instuctor can add questions whenever he needs and the question and
> answer fields are appended with the questions counter
> 
> I've created a javascript function to validate the questions
> the problem is that it doesn't work in  IE it worked in firefox
> 
> this is how I access the fields
> for (i=1 ; i<= counter ; i++)
> {	
> 	if ((q = myform.elements["Q_" + i]))
> 	{
> 
> 		if ( q.value == "")
> 		{
> 	 		str = str + 'enter a question plz'
>                 }
> 	}	
>               
> }
> in IE  q is considered undefined!
> 
> is there any other option, coz I need the code to work in IE
> thank you
> aurora
>



[Non-text portions of this message have been removed]



------------------------ Yahoo! Groups Sponsor --------------------~--> 
AIDS in India: A "lurking bomb." Click and help stop AIDS now.
http://us.click.yahoo.com/VpTY2A/lzNLAA/yQLSAA/9rHolB/TM
--------------------------------------------------------------------~-> 

Unsubscribe
[email protected]

List info
http://www.quirksmode.org/dom/list.html 
Yahoo! Groups Links

<*> To visit your group on the web, go to:
    http://groups.yahoo.com/group/wdf-dom/

<*> To unsubscribe from this group, send an email to:
    [email protected]

<*> Your use of Yahoo! Groups is subject to:
    http://docs.yahoo.com/info/terms/
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.