Snitz Forums 2000
Snitz Forums 2000
Home | Profile | Register | Active Topics | Members | Search | FAQ
Username:
Password:
Save Password
Forgot your Password?

 All Forums
 Snitz Forums 2000 MOD-Group
 MOD Add-On Forum (W/Code)
 Login / PW boxes: Text disappears on click
 New Topic  Topic Locked
 Printer Friendly
Author Previous Topic Topic Next Topic  

TestMagic
Senior Member

USA
1568 Posts

Posted - 23 February 2003 :  17:49:21  Show Profile  Visit TestMagic's Homepage
First, I'm not sure whether this goes in the w/code or w/o code forum, but since it has new code, I'll post in the w/ code Forum. Feel free to move it if necessary.

For a few days, I've been trying to figure out how to include text in a text box, make that text disappear when the user clicks in the box (onFocus) and reappear if the user doesn't enter any info (onBlur), all without any Javascript. I'm using this bit of code on a few text boxes on my site, but not on my forum, because I think it might confuse some people who think that the text is their information retrieved from a cookie.

I'm not sure how useful this will be to anybody, but I know some forums use this type of code, so I'm posting it here in case anybody finds it useful, either for their forum or for their website.

Demo: http://www.testmagic.com/forum_02/ (this is a test forum, and won't be there forever!)

In inc_header.asp, my line 364 add the parts in red:
			Response.Write	"                <td><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><b>Username:</b></font><br />" & vbNewLine & _
					"                <input type=""text"" value=""username"" onBlur=""if(this.value==''){this.value='username';}"" onFocus=""if(this.value=='username'){this.value='';}""name=""Name"" size=""10"" maxLength=""25"" value=""""></td>" & vbNewLine & _
					"                <td><font face=""" & strDefaultFontFace & """ size=""" & strFooterFontSize & """><b>Password:</b></font><br />" & vbNewLine & _
					"                <input type=""password"" name=""Password"" value=""password"" onBlur=""if(this.value==''){this.value='password';}"" onFocus=""if(this.value=='password'){this.value='';}""size=""10"" maxLength=""25"" value=""""></td>" & vbNewLine & _
					"                <td valign=""bottom"">" & vbNewLine

Snitz rocks! · Search 2

billbitsmart©
Starting Member

9 Posts

Posted - 06 March 2003 :  12:01:21  Show Profile
Simple, but very effective.
Ta much...
Go to Top of Page
  Previous Topic Topic Next Topic  
 New Topic  Topic Locked
 Printer Friendly
Jump To:
Snitz Forums 2000 © 2000-2021 Snitz™ Communications Go To Top Of Page
This page was generated in 0.14 seconds. Powered By: Snitz Forums 2000 Version 3.4.07