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

fails in FF3 not in IE7

Status
Not open for further replies.

logo66

IS-IT--Management
Jul 18, 2008
4
0
0
GB
Code:
<div onclick="hilight(this.id);" id="tr3" style="height:55px;width:55px">Away</div>

<script type="text/javascript">
function hilight(b){
var trid = document.getElementById(b);
trid.style.background=(trid.style.background == "url(http:\/\/l.yimg.com\/i\/i\/uk\/any\/ylogo.gif)") ? "url(http:\/\/[URL unfurl="true"]www.google.co.uk\/intl\/en_uk\/images\/logo.gif)"[/URL] : "url(http:\/\/l.yimg.com\/i\/i\/uk\/any\/ylogo.gif)";
}
</script>

the code above works in IE7 but not FF3, any ideas ? ..thanks
 
desperately trying different ways, apostrophes no apostrophes, makes no odds, doesn't work.

thanks anyway.
 
I don't think I can install FF2 while FF3 is installed in this PC, so could someone please check that the following at leasts works in FF2 ?.


Code:
<div onclick="hilight(this.id);" id="tr3" style="height:70px;width:80px;background:url([URL unfurl="true"]http://i38.tinypic.com/6ss9w1_th.png);cursor:pointer;">&nbsp;</div>[/URL]

<script type="text/javascript">
function hilight(b){
var trid = document.getElementById(b);
trid.style.background=(trid.style.background == "url([URL unfurl="true"]http://i35.tinypic.com/2mp03ex.jpg)")[/URL] ? "url([URL unfurl="true"]http://i38.tinypic.com/6ss9w1_th.png)"[/URL] : "url([URL unfurl="true"]http://i35.tinypic.com/2mp03ex.jpg)";[/URL]
}
</script>
[code]

what you should see is, when clicking the image it goes from cross to tick and back again, in FF3 (3.01) it just goes to tick but not back again.

I'd appreciate anyone with FF2 that has the time to check it for me, thank you.
 
didn't work in FF2....

so for any future googlers, this worked in all three,

Code:
<div onclick="hilight(this.id);" id="tr3" style="height:70px;width:80px;background:url([URL unfurl="true"]http://i38.tinypic.com/6ss9w1_th.png);cursor:pointer;">&nbsp;</div>[/URL]
<script type="text/javascript">
var result=new Boolean("false");
function hilight(b){
var trid = document.getElementById(b);
result = (result=="false") ? "true" : "false";
if(result=="true"){trid.style.background='url("[URL unfurl="true"]http://i38.tinypic.com/6ss9w1_th.png")';}else[/URL]
{trid.style.background='url("[URL unfurl="true"]http://i35.tinypic.com/2mp03ex.jpg")';}[/URL]
}
</script>


no idea why it had to be done this way, but, .... so it goes...
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top