Computer Science Canada Highlighted text-input boxes |
Author: | Martin [ Sun Oct 23, 2005 7:05 pm ] |
Post subject: | Highlighted text-input boxes |
How can I make the text-input boxes on a page highlight when selected (similar to the login/password/search boxes at http://www.deviantart.com/)? Is it just a css option? Thanks in advance. |
Author: | rdrake [ Sun Oct 23, 2005 7:46 pm ] | ||||
Post subject: | |||||
You need to use a mixture of CSS and JavaScript. Here's an example:
Just play around with that example to do what you want. On most browsers (except IE for sure), I know you can do something like the following, but it only works on FireFox, Opera, and probably a few other browsers.
It's much easier to use the last example, but like I said, IE doesn't support it. |
Author: | Martin [ Sun Oct 23, 2005 7:47 pm ] |
Post subject: | |
Hey, sweet, thanks a ton ![]() |
Author: | Martin [ Sun Oct 23, 2005 8:00 pm ] | ||
Post subject: | |||
The line
is giving me a warning on onFocus and onBlur saying that "Attribute name (onFocus/onBlur) uses wrong case character. Eh? |
Author: | rdrake [ Sun Oct 23, 2005 8:18 pm ] | ||
Post subject: | |||
|
Author: | Martin [ Sun Oct 23, 2005 8:20 pm ] |
Post subject: | |
Oh, it works, it's just eclipse giving me the warning. Whatever...ahh.. Also, do you know how I can change the border on a <select> menu? |
Author: | rdrake [ Sun Oct 23, 2005 8:28 pm ] | ||
Post subject: | |||
Sure do. I'll give you an example. Basically what you do is assign a class (or not if you want all to be the same) and just use the CSS border element to change the borders.
It doesn't look like IE supports this though. This is the only way I'm aware of at the moment. |
Author: | rdrake [ Sun Oct 23, 2005 8:52 pm ] | ||
Post subject: | |||
Oops, forgot I wrote a tutorial for this kinda thing before. So I have another, shorter way of writing the above code. It'll save a lot of hassle and make your code easier to read.
|
Author: | Martin [ Mon Oct 24, 2005 9:31 pm ] |
Post subject: | |
Hey, thanks a ton. The reason it was giving me a warning was because apparently 'onFocus' and 'onBlur' are supposed to be 'onfocus' and 'onblur' respectively. |