logo-dw

Go Back   Dreamweaver Club Forums > Hand Coders Forum > Javascript and JS frameworks
Register FAQ Members List Search Today's Posts Mark Forums Read

Reply
 
Thread Tools Display Modes
Old 03-11-2009, 03:22 PM   #1
mangofreak
mangofreak's Avatar
 
Join Date: Jan 2006
Location: Toronto-Canada
Posts: 444
Default text input field behaviour

Hey guys,

here is my problem. I have a form with meny input fields. As initial value I have: Type your name here. Once I have the page live, the field text needs to be deleted for the user to type his/her name. What I have seen and I want to do is to have the initioal value as is but when the user clicks on the text field to fill in the inital value disapears.

I hope it is clear enough...if not please let me know,

Thanks in advance,

Javier
__________________
J.
DW | FW | HTML | CSS | ASP | some PHP | Windows | Ubuntu
mangofreak is offline   Reply With Quote
Old 03-12-2009, 02:25 AM   #2
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

found this , havent tried it though

<script language="Javascript">
<!--

function Clear(Text) {
if (Text.value == Text.defaultValue)
{ Text.value = ""
}
}
//-->
</script>
<form>
<input type="text" size=15 value="Enter name" onFocus="Clear(this)">
</form>
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 03-12-2009, 02:38 AM   #3
edbr
edbr's Avatar
 
Join Date: Aug 2005
Location: Bali
Posts: 11,176
Default

this maybe better
http://mindpalette.com/tutorials/cle...ults/index.php
__________________
If you're happy and you know it shake your meds!
different style links examples

Flight / Hotel search
Free script download
Bali Villas
edbr is offline   Reply With Quote
Old 03-12-2009, 12:06 PM   #4
davidj
davidj's Avatar
 
Join Date: Sep 2005
Location: The Toon (newcastle upon Tyne)
Posts: 8,256
Default

that removes the text but if you move away from the field the field stays empty

what you need is to detect when blank and then reinsert the original text (label)
__________________
Would you like to learn PHP from me? Check out -> www.codezenith.co.uk
davidj is offline   Reply With Quote
Old 03-12-2009, 04:18 PM   #5
mangofreak
mangofreak's Avatar
 
Join Date: Jan 2006
Location: Toronto-Canada
Posts: 444
Default

EDBR, Thanks for the code. It works fine for what I need.

The page I have is full of promotional Items available only to distributors. The page shows the prices those items are offered to them and the distributors can put on those fields their own marked up prices. So, they have to click on each input field and add a price.

So far so good. Thanks again.

DavidJ, I must admit that I'm just a hack with javascript and as such it takes me a very long time to write anything. However, if you have a tutorial to the technique you have in mind, please let me know.

Cheers,

Javier
__________________
J.
DW | FW | HTML | CSS | ASP | some PHP | Windows | Ubuntu
mangofreak is offline   Reply With Quote
Reply


Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT. The time now is 03:38 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2017, vBulletin Solutions, Inc.
Copyright 2006 DreamweaverClub.com