Click to See Complete Forum and Search --> : Why won't work in Firefox?


Webskater
06-25-2007, 08:43 AM
Hi

I have this in my .css file

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

and this on a page:

<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">

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.

Fang
06-25-2007, 08:53 AM
:confused: Works in Fx and IE7, but not IE6 of course.

Webskater
06-25-2007, 09:51 AM
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

Fang
06-25-2007, 09:59 AM
Removing the attribute selector would let it work in IE6
Can't see why it's not working in Fx for you.

Webskater
06-26-2007, 03:51 AM
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?

Fang
06-26-2007, 04:23 AM
DTD should not affect CSS:confused: Still no problem with Fx.