By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,945 Members | 1,692 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,945 IT Pros & Developers. It's quick & easy.

Problem with Javascript & Firefox

P: 14
Hi,

ive got the following functions included in my page. with IE they are perfectly working. with firefox it seems like they are not there at all ...

Expand|Select|Wrap|Line Numbers
  1. function img_toggle(img) {
  2.     var img = document.getElementById("img" + img);
  3.     img.background = "bg/t2.gif";
  4.     img.style.cursor = "hand";
  5. }
  6.  
  7. function img_toggleback(img) {
  8.     var img = document.getElementById("img" + img);
  9.     img.background = "bg/t1.gif";
  10.     }
  11.  
the sourcecode of FF shows the following

Expand|Select|Wrap|Line Numbers
  1. <a href="index.php?id=neuen"><td height="40" class="link" align="left" background="bg/t2.gif" id="img1" onMouseOver="img_toggle('1')"  >&nbsp;&nbsp;neueste Beiträge</td></a>
anybody any idea why this is so?
thanks very much in advance.
Jan 12 '08 #1
Share this Question
Share on Google+
5 Replies


acoder
Expert Mod 15k+
P: 16,027
Welcome to TSDN!

There's no background property for table cell (td) tags. See the standard.

Use the tdref.style.backgroundImage property instead.
Jan 12 '08 #2

P: 14
thanks,
ill try it :)
Jan 13 '08 #3

acoder
Expert Mod 15k+
P: 16,027
Let us know if you manage to get it working.
Jan 13 '08 #4

P: 14
hi,

just as I was about to try it, i got another idea which works perfectly now.

I just did it with css and lists, completely without js. I recon its way better because theres less code and its more flexibel.

but thanks for your answer anyway :)
Jan 15 '08 #5

acoder
Expert Mod 15k+
P: 16,027
I just did it with css and lists, completely without js. I recon its way better because theres less code and its more flexibel.
Oh, of course! It'll also work even if JavaScript is turned off.

Glad you managed to solve it. Post again if you have more JavaScript queries.
Jan 15 '08 #6

Post your reply

Sign in to post your reply or Sign up for a free account.