Page 1 of 2 12 LastLast
Results 1 to 10 of 11

Thread: [DHTML] TexTitle

  1. #1
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default [DHTML] TexTitle

    1) CODE TITLE: TexTitle

    2) AUTHOR NAME/NOTES: Jeffrey M. Tackett

    3) DESCRIPTION: This code creates title text in textbox that is cleared when the textbox get focus.

    4) URL TO EXAMPLE: http://personal.jeffreytackett.us/test.html

    ATTACHED BELOW IS THE CODE:

  2. #2
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Amazingly close to what I posted here:
    http://dynamicdrive.com/forums/showp...&postcount=101


    <input name="email" type="text" value="your@email.com" onFocus="if (this.value=='your@email.com') {this.value='';}" onBlur="if (this.value=='') {this.value='your@email.com';}">


    Additionally, you wouldn't want people submitting your@email.com to the thing.
    I'd suggest:
    <form action="page.php" method="post" onSubmit="if (email.value=='your@email.com') {alert('Please enter your email.'); email.focus(); return false;}">
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  3. #3
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Exclamation Nothing Like Your Code

    I did not look at the forums before creating this code and I made my version pull the title attribute to place in the textbox. The method I created follows the standards on how to use textboxes. http://www.w3.org/TR/2005/WD-WCAG20-...0/#label-title

    What you are trying to say is my code is like your code is the same as the fact that there are many different versions of image gallrey DHTML code. I am sorry, but your code is not as flexable as mine. With my code you can create different styles for diffrent textboxes and yours only creates text in the textbox.

  4. #4
    Join Date
    Aug 2004
    Posts
    10,143
    Thanks
    3
    Thanked 1,008 Times in 993 Posts
    Blog Entries
    16

    Default

    Maybe I'm missing something, but what exactly does this script do? It seems to merely change the style of the text field depending on the state, which doesn't seem particularily useful. That's just my opinion though.

  5. #5
    Join Date
    Mar 2006
    Location
    Illinois, USA
    Posts
    12,164
    Thanks
    265
    Thanked 690 Times in 678 Posts

    Default

    Yeah, I'm a bit lost too.

    Mine does exactly what yours does, except for making the text a bit faded out when it's the default value, not user entered.

    I'm not accusing you of stealing it or anything.... just saying they do the same thing.

    True that yours is a function, though.
    Daniel - Freelance Web Design | <?php?> | <html>| español | Deutsch | italiano | português | català | un peu de français | some knowledge of several other languages: I can sometimes help translate here on DD | Linguistics Forum

  6. #6
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Question Not Sure How This is Not Useful

    You have image rollovers and this is like the same thing for textboxes, I see many sites using this same type of thing and thought that I would try and create my own code that does the same effect. Look at http://sourceforge.net/index.php to see how it can be used, they have a search box in the upper right-hand corner. This could also give more information on what to put in the textbox, I put some examples on my test page to show how it could help. This is also something all the Ajax apps have and thought that a simple funtion was something that some people would like to include in there app, just so someone does not have to reinvent the wheel. I know that this is a simple script that does not do much, but so is an image rollover.

  7. #7
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    After blur occurs, the textboxes have a color but not a background-color set.

    Also, you might want to do something better than simply change the text colour to signify a highlighted/non-highlighted textbox... maybe something with opacity?

    I agree that this is a handy script, and generally well-written, but it uses browser detection (which, by the way, is in a completely different coding style).
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  8. #8
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    You can use any class you want, I was just using a simple example. If you are wanting a fade effect, then you are free to write the code for that. This code is released under GPL. I just wanted it to be a lightweight script that did not throw errors on browsers that don't support the functions that I use (that is why I don't use the script attributes of HTML tags, but keep all of my scripts between script tags).

  9. #9
    Join Date
    Jun 2005
    Location
    英国
    Posts
    11,876
    Thanks
    1
    Thanked 180 Times in 172 Posts
    Blog Entries
    2

    Default

    I just wanted it to be a lightweight script that did not throw errors on browsers that don't support the functions that I use (that is why I don't use the script attributes of HTML tags, but keep all of my scripts between script tags).
    Good practice, but that's not why you should be doing it Event handlers are supported by all browsers that support scripting, insofar as I'm aware; and, like all unknown HTML attributes, ignored by those that don't.

    You will correct the browser detection?
    Twey | I understand English | 日本語が分かります | mi jimpe fi le jbobau | mi esperanton komprenas | je comprends français | entiendo español | tôi ít hiểu tiếng Việt | ich verstehe ein bisschen Deutsch | beware XHTML | common coding mistakes | tutorials | various stuff | argh PHP!

  10. #10
    Join Date
    Mar 2006
    Posts
    5
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by Twey
    Good practice, but that's not why you should be doing it Event handlers are supported by all browsers that support scripting, insofar as I'm aware; and, like all unknown HTML attributes, ignored by those that don't.

    You will correct the browser detection?
    I am working on an update, so I will test all the browsers that I can. The biggest reason for me to use the brower detection is the fact that Opera did not support javascript very well before 7 and I just did not have an old version on my computer. I will download the old verisons and see where things die, if at all.

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
  •