Stumped with Javascript and FireFox

J

Jonathan Wood

I'm developing the site at http://www.medicorpmap.com.

I created a warning that javascript is disabled and then registered a
start-up script to hide the warning. This way, users will see the warning if
javascript is not working.

When I view the page, the warning is gone, unless I use FireFox.

Does anyone know why my javascript doesn't appear to work under FireFox?

Here's the server-side code:

// Start-up script to hide javascript warning
if (!Page.ClientScript.IsStartupScriptRegistered("JavaWarn"))
Page.ClientScript.RegisterStartupScript(typeof(Page), "JavaWarn",
"document.getElementById('javawarning').innerText='';", true);

I also tried outerText, which also seems to be ignored by FireFox.

Thanks.
 
S

sloan

When debugging javascript.. I find it useful to set a variable to your
return "getElementById" and test for null.


var jwTextBox = document.getElementById('javawarning');
if(null==jwTextBox)
{
alert('This browser does not like the Find like the others');
}
else
{
jwTextBox.innerText = 'howdy doody';
jwTextBox.value = 'abc123';//make sure you picked the correct property
as well...do some googling to make sure
}

Something like that.

You can short hand it after you figure out what the deal is.
 
J

Jonathan Wood

Yeah, thanks. I have quite a few years experience debugging but, here, it
just seems like a big guessing game. Is there no good references on
javascript implementation in various browsers?

At any rate, I verified my script is actually running and getElementById is
not returning null. If I change it to set style.display='none'; the message
disappears. I can do that but I still don't know why the other doesn't work,
or what else on my site might not work.

I'm off to the bookstore for a book on ADO. Perhaps I can find a better
javascript reference while I'm there.

Thanks again.
 
S

sloan

// it just seems like a big guessing game//

I feel the same way most of the time.

VS2008 was showing off some better javascript debugging abilties.


But yeah...javascript debugging and property setting is .... a fickle
feller.
 
J

Jonathan Wood

sloan,
VS2008 was showing off some better javascript debugging abilties.

I saw that. I'm using VS2008 but still have absolutely no idea how to
implement javascript debugging. In addition, I don't think it would be
helpful for issues like the one I raised because it works fine in IE and the
javascript browser, being from Microsoft, would probably work like the ones
in IE.
But yeah...javascript debugging and property setting is .... a fickle
feller.

Indeed.
 
B

bruce barker

innerText is IE only (and some IE compatiable browsers). the w3c method is
contentText (to match xml dom processing), so try:

var v = ";";
var e = document.getElementById('javawarning');
if (e.innerText != undefined) e.innerText=v;
else e.textContent = v;

you could also use innerHTML which all browser support. or

-- bruce (sqlwork.com)
 
J

Jonathan Wood

Thanks Bruce. Clearly, that is the sort of information I'm lacking.

Can you recommend a good reference on this? I know w3c has a Website--is
that the best? Or perhaps you can recommend a book.

Thanks again.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,744
Messages
2,569,482
Members
44,901
Latest member
Noble71S45

Latest Threads

Top