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 strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

NS don't change color

Status
Not open for further replies.

shnaeem

Programmer
Apr 2, 2001
10
US
I want to change the background color of Table row using javascript at run time depending on some parameter. I am using following code. Works fine in IE but NS it does not change at all.

< %@ Language=&quot;VBScript&quot;%>
<HTML>
<BODY>

<BR>
<TABLE border = 1>
<TR id=R1>
<TD>Column 1
</TD>
</TR>
<TR>
<TD>Column 2
</TD>
</TR>
</TABLE>
<BR>

< %
dim t
t=true
if t=true then
Response.Write &quot;<SCRIPT Language = &quot;&quot;JavaScript1.2&quot;&quot;>&quot; & vbCRLF
Response.Write &quot;R1.bgColor = &quot;&quot;RED&quot;&quot; ;&quot; & vbcrlf & _
&quot;</SCRIPT>&quot; & vbcrlf
end if
% >

</BODY>
</HTML>
<SCRIPT>

</SCRIPT>
 
I was under the impression that VBScript would only work in IE...I could be wrong though.
 
Oki
Now i must make it clear that the function which is changing the color is JavaScrtipt, it is not VB Script. If you are talking about VBSCRIPT in ASP then, my answer is that it would be runing at the server, so as long as i don't write the client code in VBScript it is ok.

My question is how could i do this thing in Java Script not in VB SCript.

 
Sorry, I kind of forgot I posted on this thread or I would've gotten back to you sooner.
If you want it to work in Netcape 6 (and IE) you can do this:
Code:
<HTML>
<BODY>

<BR>
<TABLE border = 1>
<TR id=R1>
<TD>Column 1
</TD>
</TR>
<TR>
<TD>Column 2
</TD>
</TR>
</TABLE>
<BR>

<script language=&quot;javascript&quot; type=&quot;text/javascript&quot;>
var t=&quot;true&quot;
if (t==&quot;true&quot;) {
document.getElementById('R1').style.backgroundColor = &quot;red&quot;
}
</script>
</BODY>
</HTML>

If you're looking for a Netscape 4.7x solution, let me know and I'll see if I can figure anything out...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top