Beta Posted December 2, 2006 Report Share Posted December 2, 2006 <span style="color: rainbow"></span><script type="text/javascript"><!--var Span = document.getElementsByTagName("span");for(e = 0; e < Span.length; e++) { if(Span[e].style.color == "rainbow") { Span[e].innerHTML = "RAINBOW!!!"; }}// --></script> Anyone know why that doesn't work? I'm thinking it's because "rainbow" isn't a default color...but should that even matter? o.o Link to comment Share on other sites More sharing options...
Chocolate570 Posted December 2, 2006 Report Share Posted December 2, 2006 <span style="color: rainbow"></span><script type="text/javascript"><!--var Span = document.getElementsByTagName("span");for(e = 0; e < Span.length; e++) { if(Span[e].style.color == "rainbow") { Span[e].innerHTML = "RAINBOW!!!"; }}// --></script> Anyone know why that doesn't work? I'm thinking it's because "rainbow" isn't a default color...but should that even matter? o.o I don't believe the HTML allows that. Link to comment Share on other sites More sharing options...
jesh Posted December 4, 2006 Report Share Posted December 4, 2006 When I run the code in Firefox it says "Expected color but found 'rainbow'. Error parsing value for property 'color'. Declaration dropped."So, in firefox, the color for the span is never set to "rainbow" so the javascript can't find a span element with that color property. If you change the color from "rainbow" to "red" in both the HTML and in the javascript it works. Link to comment Share on other sites More sharing options...
pulpfiction Posted December 4, 2006 Report Share Posted December 4, 2006 Then it seems like there in no such named color "rainbow"... Link to comment Share on other sites More sharing options...
Beta Posted December 5, 2006 Author Report Share Posted December 5, 2006 There isn't, but i've made a prototype function that makes a String glow random colors at a setInterval rate....so i was trying to make it find that span tag instead of looking for a tag that i create myself :/See, this is all for an InvisionFree forum. The tag auto-parses to a span with the color value assigned to it. i wanted to try [color*=rainbow], as it creates a span with that color already assigned, so that i would have to parse the tag myself :/ but i guess theres no real way around it as the HTML doesn't even allow it ...lol Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now