Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
Home
Discussion GroupsGeneralPHPASPPerlColdFusionFlashHTML, CSS, ScriptsBrowsers

Webmaster Forum / HTML, CSS, Scripts / CSS / February 2007



Tip: Looking for answers? Try searching our database.

Button active

Thread view: 
Enable EMail Alerts  Start New Thread
Thread rating: 
Pablito - 26 Feb 2007 09:15 GMT
Hi at all
I have an input type=submit
I want that in certain cases this button is visible but non active

How can I do please?
Regards
Pab
Jukka K. Korpela - 26 Feb 2007 10:14 GMT
Scripsit Pablito:

> I have an input type=submit
> I want that in certain cases this button is visible but non active

This is primarily a matter of functionality, not styling.

The safe way is to make the button disabled in JavaScript. (If you make it
disabled in HTML markup, there's the risk that it is _always_ disabled,
because the browser might have JavaScript turned off.)

The default appearance in most browsers is then "grayed-out".

You can then try to affect its appearance as well. It's probably easiest to
do that in JavaScript, too, e.g.

<input id="foo" type=submit name="foo" value="bar">
<script type="text/javascript">
var fld = document.getElementById("foo");
fld.disabled = true;
fld.style.color = "blue";
fld.style.fontFamily = "Courier";
</script>

Here I set the color and font-family for demonstration only. You will see on
IE for example that the font-family setting takes effect while the color
setting does not - presumably because the browser uses built-in system
routines for rendering disabled fields.

Signature

Jukka K. Korpela ("Yucca")
http://www.cs.tut.fi/~jkorpela/

 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2009 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.