By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
437,677 Members | 1,798 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 437,677 IT Pros & Developers. It's quick & easy.

Button active

P: n/a
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
Feb 26 '07 #1
Share this Question
Share on Google+
1 Reply


P: n/a
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.

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

Feb 26 '07 #2

This discussion thread is closed

Replies have been disabled for this discussion.