Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > innerHTML not being recognized in FireFox

Reply
Thread Tools

innerHTML not being recognized in FireFox

 
 
Buster
Guest
Posts: n/a
 
      04-15-2008
Hello,

First, this works fine in IE 6.5 and 7. Second, this is javascript
embedded in ASP code. The purpose of this is to assign letters to form
fields that are being rendered in an ASP loop.

First part, I assign a div tag for the "marker" positions:

do Until rs4.EOF
address = address & "<div id=""marker""></div><input type='image'
SRC='images/gobutton.gif' border=0>"
rs4.MoveNext
Loop
rs4.Close
set rs4 = nothing

Second, I confirm that we are getting the object with an alert:

Response.Write("<script type=""text/javascript""> var formMarker =
document.getElementsByName('marker');alert(formMar ker);</script>")

Third, I am doing a final loop where I am outputting the values (A, B,
C)

do while iiLoop < totalRecord
Response.Write("<input type=""hidden"" name=""dealerName" & iiLoop &
""" value=""" & dynamicAddressArray(0,iiLoop) & """>")
Response.Write("<p>" & dynamicAddressArray(1, iiLoop))
iiLoop = iiLoop + 1

If iiLoop = "1" Then
Response.Write("<script type=""text/javascript"">
formMarker[0].innerHTML = 'A'</script>")
End If

If iiLoop = "2" Then
Response.Write("<script type=""text/javascript"">
formMarker[1].innerHTML = 'B'</script>")
End If

If iiLoop = "3" Then
Response.Write("<script type=""text/javascript"">
formMarker[2].innerHTML = 'C'</script>")
End If
Loop

I've Googled this, searched through many KB's and forums, tried many
different syntax variations, cannot get FireFox to output these
values.

Thank you for your time,
Buster
 
Reply With Quote
 
 
 
 
Richard Cornford
Guest
Posts: n/a
 
      04-15-2008
"Buster" wrote:
> First, this works fine in IE 6.5 and 7. Second, this
> is javascript embedded in ASP code.


No it is not, it is javascript generated by ASP code. When it is "in"
the ASP it is just text, and when it gets to become javascript (when it
reaches the client) the ASP is finished.

> The purpose of this is to assign letters to form
> fields that are being rendered in an ASP loop.


Browsers do the 'rendering', all this loop does is assemble mark-up to
be sent to a browser.

<snip>
> address = address & "<div id=""marker""></div><input

<snip>
> Response.Write("<script type=""text/javascript""> var
> formMarker = document.getElementsByName('marker');
> alert(formMarker);</script>")

<snip>

Your DIV elements don't have NAME attributes (and should not have them)
so trying to retrieve a collection of them using - getElementsByName -
should not be expected to be effective. And ID attributes are supposed
to be unique within a single document.

But why attempt to use - innerHTML - to put the content into the DIV
elements on the client when you could put the contents into the DIVs in
the mark-up generated by the ASP on the server?

Richard.


 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
xhtml, innerHtml, appendChild, and innerHTML. what is the exact proper way to do this with DOM sonic Javascript 5 07-11-2006 08:17 AM
1.1 Button Event not being recognized jw56578@gmail.com ASP .Net 1 04-01-2006 06:30 AM
Tomcat Servlet not being recognized or something... 6e Java 1 04-13-2005 03:14 AM
Internal wireless network card not being recognized =?Utf-8?B?Qm9iIFM=?= Wireless Networking 2 01-20-2005 08:21 PM
Re: onkeypress not being recognized, or not firing S. Justin Gengo ASP .Net 0 08-26-2003 04:15 PM



Advertisments