Click here to Skip to main content
15,072,051 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
I always believe Firefox is a worse browser than chrome for javascript.The two code is fired in chrome,but not in firefox-----------

>This alerts "Undefined" in firefox but the innertext is alerting perfect result in chrome.So how to write the code for firefox?
Note:"listprice" is a

2.I have created image in runtime and added the code:
img.Attributes.Add("onmousemove", "javascript:movediv('imageShow','event')");

"imageShow" is the id of the div which will be moved on moving mouse over the image.

javascript code:

function movediv(element,e)
var v=document.getElementById(element);'px';'px';'8px';'center';

this works in chrome,but not in firefox.How to write this for firefox?Please help.
Updated 13-Aug-12 23:07pm

Try this

souvikcode 15-Aug-12 12:22pm
this helps.good.
souvikcode 15-Aug-12 12:44pm
In which chrome differ from Mozilla?appCodeName and appName is same for these two browsers,so how to get difference between them?
pradiprenushe 16-Aug-12 0:59am
You can do like this
if(document.getElementById('ctl00_ContentPlaceHolder1_listprice').innerText != undefined)
else if(document.getElementById('ctl00_ContentPlaceHolder1_listprice').innerHtml!= undefined)
else if(document.getElementById('ctl00_ContentPlaceHolder1_listprice').textContent!= undefined)
I find firefox javascript errors much easier to resolve than the dreaded IE 'Guess where the error occured' style of debugging but since it works in chrome we can safely assume FF is the problem.

If I look at :
function movediv(element,e)
var v=document.getElementById(element);

The position of where you place your script may be the problem.
For instance with scripts like these I usually prefer to place my script tagas right under

Hope this helps

also as a tip
<script type="text/JScript"> </script>
will only work on certain browsers type="text/javascript" for the win (not sure if this could be the issue

also check your source and ensure that a control with name 'imageShow' actually exists , it its a server control you might have to use the ClientID to get the valid javascript ID.
souvikcode 15-Aug-12 12:21pm
Please Submit perfect answer.
L Viljoen 16-Aug-12 6:15am
for a perfect answer I need the source of what is causing the issue , as in the whole document , I gave you answers based on what could be causing the issue in firefox, I dont have your document so I have to guess what the issue is.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900