/    Sign up×
Community /Pin to ProfileBookmark

Not working in FireFox… ;-(

I implemented javascript in my web applicatiOn for dispLaying errOrs. I used Style’s color prOperty tO set error msg’s cOlor dynamicaLLy for validated fieLds within cLient.

[CODE]n_error=0;

function validateForm(frm) {

if (frm.txtFName.value.length<4) {
nameErrorMsg.style.color=”#ff0000″;
n_error++;
}
else {
nameErrorMsg.style.color=”#ffffff”;
n_error=0;
}

<!–
Other text gOSe here
–>

if (n_error<1)
frm.submit();
}[/CODE]

It wOrks fine in IE 6.0. But dOesnt wOrk in FireFox.
Is there any Other Code snippets to dO this unstead of using

[CODE]nameErrorMsg.style.color=”#ffffff”;[/CODE]

?????
How can I get this dOne in FirefOx??

to post a comment
JavaScript

7 Comments(s)

Copy linkTweet thisAlerts:
@FangMay 26.2007 — What is [I]nameErrorMsg[/I]?

Please don't use random capitals; it's irritating to read.
Copy linkTweet thisAlerts:
@firebladeauthorMay 26.2007 — .
nameErrorMsg [/QUOTE] is A CSS style element.
<div id="nameErrorMsg" name="nameErrorMsg">[/QUOTE]
How can I cgange it being inside FirefOx. It is wOrking inside IE6.0
Copy linkTweet thisAlerts:
@FangMay 26.2007 — Please don't use random capitals; it's irritating to read.[/QUOTE]
cc
Copy linkTweet thisAlerts:
@firebladeauthorMay 26.2007 — Ok Sory

Please Give Me Reply
Copy linkTweet thisAlerts:
@FangMay 26.2007 — var nameErrorMsg = document.getElementById('nameErrorMsg');
Copy linkTweet thisAlerts:
@mrhooMay 26.2007 —  <!--

Other text gOSe here

-->[/QUOTE]

HTML comment tags IN a javascript can gag the browser-

unless you comment them with js comments:[CODE]
/*
<!--
Other text gOSe here
-->
*/[/CODE]
Copy linkTweet thisAlerts:
@firebladeauthorMay 26.2007 — what I am saying is...

This code is not working with firefox while working in IE6.0.

I want to knOw what shOuLd I change tO be wOrk in bOth brOwsers??

wiLL it wOrk if I dO like
var nameErrorMsg = document.getElementById('nameErrorMsg');[/QUOTE]

???
×

Success!

Help @fireblade spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 4.29,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @Yussuf4331,
tipped: article
amount: 1000 SATS,

tipper: @darkwebsites540,
tipped: article
amount: 10 SATS,

tipper: @Samric24,
tipped: article
amount: 1000 SATS,
)...