Neato Input + javascript color "trick"

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Neato Input + javascript color "trick"

Post by phice »

Code: Select all

<FORM><INPUT TYPE="Text" NAME="test_Colors" VALUE="Click inside here" onFocus="if (document.all) this.style.backgroundColor='#F0F0F0';" onBlur="if (document.all) this.style.backgroundColor='#FFFFFF';"></FORM>
When a user is input his/her data into text fields (I haven't tested it on anything else), it'll change the background on that certain input tag. Very nice for helping the user know where they're typing..
Image Image
User avatar
phpPete
Forum Commoner
Posts: 97
Joined: Sun Aug 18, 2002 4:40 pm
Location: New Jersey

Post by phpPete »

Clever
User avatar
Takuma
Forum Regular
Posts: 931
Joined: Sun Aug 04, 2002 10:24 am
Location: UK
Contact:

Post by Takuma »

Cool thing, one thing that you can improve on if the text input background color isn't white it'll be a bit of problem so:-

Code: Select all

<FORM><INPUT TYPE="Text" NAME="test_Colors" VALUE="Click inside here" onFocus="if (document.all) this.style.backgroundColor='#F0F0F0';" onBlur="if (document.all) this.style.backgroundColor='"></FORM>
:wink:
jamesf4218
Forum Newbie
Posts: 9
Joined: Mon Sep 23, 2002 10:36 am

Post by jamesf4218 »

It doesn't work on Netscape 4.x
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

Upgrade. :roll:
Image Image
User avatar
EvilWalrus
Site Admin
Posts: 209
Joined: Thu Apr 18, 2002 3:21 pm
Location: Springmont, PA USA

Post by EvilWalrus »

Netscape? That browser is still around? </sarcasm>
jamesf4218
Forum Newbie
Posts: 9
Joined: Mon Sep 23, 2002 10:36 am

Post by jamesf4218 »

I can't 'upgrade'. I design websites for a living and unfortunately, my log reports still show enough people using N4.x, that I have to program for it. I even try to make the sites work on macs too...
jamesf4218
Forum Newbie
Posts: 9
Joined: Mon Sep 23, 2002 10:36 am

Post by jamesf4218 »

It doesn't work on Netscape 7.0 or Mozilla either
User avatar
mikeq
Forum Regular
Posts: 512
Joined: Fri May 03, 2002 3:33 am
Location: Edinburgh, Scotland

Post by mikeq »

It is probably to do with different DOM in these browsers, the document.all part would need to be changed and maybe this.style.backgroundColor
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

EvilWalrus wrote:Netscape? That browser is still around? </sarcasm>
Netscape? What's that?
Image Image
User avatar
noguru
Forum Commoner
Posts: 61
Joined: Thu Jun 06, 2002 4:03 am
Location: Just north of the City Of Gold, Land of Milk and Honey

Post by noguru »

I thought PHPers (non-Microsoft programmers in general) prefered Netscape above IE??
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

I think everybody likes bashing Netscape...

Mac
User avatar
phice
Moderator
Posts: 1416
Joined: Sat Apr 20, 2002 3:14 pm
Location: Dallas, TX
Contact:

Post by phice »

noguru wrote:I thought PHPers (non-Microsoft programmers in general) prefered Netscape above IE??
Over 85% of the worlds webpages are built on IE first, then changed for netscape.
Image Image
User avatar
twigletmac
Her Royal Site Adminness
Posts: 5371
Joined: Tue Apr 23, 2002 2:21 am
Location: Essex, UK

Post by twigletmac »

Coding to standards from the offset does take a lot of the pain out of that though.

Mac
User avatar
mydimension
Moderator
Posts: 531
Joined: Tue Apr 23, 2002 6:00 pm
Location: Lowell, MA USA
Contact:

Post by mydimension »

for myself, i have learned the hard way. now when i start designing a web page i have both IE an Mozilla open and view my changes in both of them. sure its a pain but it works and my pages are better for it. now if only IE would fix its box model........
Post Reply