ok, today I'm making a helper HTML function. It looks like this:
function Input($name,$type,$lable,$value= null){
if (isset($value)) {
//if (this.value=='search') this.value = ''
echo '<label for="'. $name .'">'. $lable .'</label><input type="'.$type.'" name="'. $name .'" id="'. $name .'" value="'.$value.'" onfocus="if (this.value==\''.$value.'\') this.value = \'\' "/>';
}
if (!isset($value)) {
echo '<label for="'. $name .'">'. $lable .'</label><input type="'.$type.'" name="'. $name .'" id="'. $name .'" />';
}
}
As you can see, if you insert a value it will do some JavaScript so that when I click the box, the text inside the box will disappear,
Question: How can we make it to have a value when we are not on the input? (please look at the search box on stackoverflow, however the one that is on stackoverflow doesn't come back after we are not pointing at the input box? Maybe by using onblur? Am I right?
Hope you understand what I mean.
ok becouse some of you are not getting what i mean please see
when im not clicking it.
when im clicking it.
when im not clicking it again.
it should be
when im not clicking it.
when im clicking it.
when im not clicking it again.