/    Sign up×
Community /Pin to ProfileBookmark

Why won’t work in Firefox?

Hi

I have this in my .css file

[CODE]input[type=”submit”] {
margin: 0;
padding: 0px 2px 0px 2px;
width: auto;
overflow: visible;
}
input[type=”submit”].buttonA {
background-color: #FFFF00;
}[/CODE]

and this on a page:

[CODE]<script type=”text/javascript”>
function setbtn()
{
alert(‘hello’);
document.getElementById(‘LoginBtn’).className = ‘buttonA’;
}
</script>

<input type=”text” onkeypress=”setbtn();”>
<input type=”submit” id=”LoginBtn” value=”Log in”>[/CODE]

It works in IE but not in Firefox. Can anyone tell me why please? The function definitely fires on the onkeypress event as the alert is being show, but the button does not change color.

to post a comment
CSS

5 Comments(s)

Copy linkTweet thisAlerts:
@FangJun 25.2007 — ? Works in Fx and IE7, but not IE6 of course.
Copy linkTweet thisAlerts:
@WebskaterauthorJun 25.2007 — Hi, it doesn't work in Firefox for me.

What would I need to do to get it to work in all modern browsers?

I thought the css code was 'correct' and should work in all browsers.

Cheers
Copy linkTweet thisAlerts:
@FangJun 25.2007 — Removing the attribute selector would let it work in IE6

Can't see why it's not working in Fx for you.
Copy linkTweet thisAlerts:
@WebskaterauthorJun 26.2007 — Thanks again for your reply.

I have this at the top of the page

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

If I remove it, it works in Firefox.

So, I need to amend the doctype?
Copy linkTweet thisAlerts:
@FangJun 26.2007 — DTD should not affect CSS? Still no problem with Fx.
×

Success!

Help @Webskater 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 6.16,
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: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

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