Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations gkittelson on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

innerHTML not being recognized in FireFox 2.0.0.13

Status
Not open for further replies.

xcaliber2222

Programmer
Apr 10, 2008
70
US
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:
Code:
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:
Code:
Response.Write("<script type=""text/javascript""> var formMarker = document.getElementsByName('marker');alert(formMarker);</script>")

Third, I am doing a final loop where I am outputting the values (A, B, C)
Code:
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 have Googled this, searched through many KB's and forums, tried many different syntax variations, cannot get FireFox to output these values. I'll take any help, suggestions, advice, anything please.

Thank you for your time,
Alejandro
 
[1] You make id="marker" to all your div. It is no good in a number of sense.
[1.1] id should be unique;
[1.2] you try to retrieve the references to them by getElementsByName();
[1.3] you can change the first loop replacing the id by name.
>address = address & "<div id=""marker""></div><input type='image' SRC='images/gobutton.gif' border=0>"
[tt]address = address & "<div [red]name[/red]=""marker""></div><input type='image' SRC='images/gobutton.gif' border=0>"[/tt]
[1.3.1] But that is only partially satisfactory as name should better be consciously assigned to form field elements, not without criticism to elements like <div> if you're ultra-sensitive to w3c recommendations.

[2] You constantly use barely exposed javascript expression. Unless you know well the timing, it is better re-group real task inside functions and call them with window.onload handling. As an execise of skill, no problem, go ahead with it.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top