SitePoint Sponsor

User Tag List

Results 1 to 5 of 5
  1. #1
    Addict obliquegeek's Avatar
    Join Date
    Aug 2004
    Location
    England
    Posts
    340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Just a couple of quick ones...

    Hi all, just a few questions that I really should know the answer to...

    1, Why, in Firefox, is the box for people to enter their email into on my contact form yellow while the rest are white? It's not something I'm doing.

    2, How do you get the input box to clear the preset value when the user clicks on it?

    3, How do I implement a subdomain?

    Cheers in advance for any help.
    "Everything should be as simple as possible,
    but no simpler" - Albert Einstein

  2. #2
    Galactic Overlord gold trophysilver trophybronze trophy
    HAWK's Avatar
    Join Date
    Aug 2003
    Location
    New Zealand
    Posts
    12,597
    Mentioned
    984 Post(s)
    Tagged
    14 Thread(s)
    The yellow field may have something to do with your form autocomplete. If you have Google toolbar installed for instance, you can set your form autocomplete to fill out forms for you at the click of a button. It highlights fields yellow if it knows the answer...

    If that is the case, it won't be yellow for everyone. You can test it by changing the field name to something ridiculous so that the autocomplete doesn't recognise it as an email input field...

  3. #3
    SitePoint Enthusiast Darren Hoyt's Avatar
    Join Date
    May 2006
    Location
    Virginia, USA
    Posts
    55
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    It's for accessibility purposes regarding the Google toolbar and auto-fill feature. You can always use something like this to override it:

    input.white{
    background: #FFF ! important;
    }

    ...but it's not considered good form if you're concerned with accessibility. See also:

    http://www.htmldog.com/ptg/archives/000017.php

  4. #4
    SitePoint Wizard bronze trophy Tyssen's Avatar
    Join Date
    Oct 2005
    Location
    Brisbane, QLD
    Posts
    4,067
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by obliquegeek
    2, How do you get the input box to clear the preset value when the user clicks on it?
    This goes in the head:

    Code:
     <script type="text/javascript">
     	//<![CDATA[
     	function clearField(thefield) {
     		if (thefield.defaultValue==thefield.value)
     		thefield.value = ""
     	} 
     	//]]>
     </script>
    and this goes in your body:

    Code:
    <input type="text" name="" value="Your text" onfocus="clearField(this)" />

  5. #5
    Addict obliquegeek's Avatar
    Join Date
    Aug 2004
    Location
    England
    Posts
    340
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Cheers for that, I was not too bothered about the yellow, more curious.

    Thanks for that little bit of JavaScript Tyssen, just what I was looking for.
    "Everything should be as simple as possible,
    but no simpler" - Albert Einstein


Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •