Jump to content

Js Onblur Onfocus


ckrudelux
 Share

Recommended Posts

" theField = this "function clearText(theField)	{	if (theField.defaultValue == theField.value)	theField.value = '';	}function addText(theField)	{	if (theField.value == '')	theField.value = theField .defaultValue;	}

Okay so this script works on my page and at the same time it don't.I have to diffrent pages on the same server both have this script but only one of the pages got it working.The page that don't get this script runing as it should clears the text onfocus but onblur it don't get the text back.At one place where I use this script I get this text then I select the textarea after the input field with the script:[object HTMLInputElement]What is wrong?? No alerts from firebug...

Link to comment
Share on other sites

Show where you call those functions on the text elements.
Here is one of them.
<input title="skriv ett sök ord här." class="topinput" type="text" name="search" onblur="addText(this);" onfocus="clearText(this)" value="Sökord" />

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
 Share

×
×
  • Create New...