mga master dara akong form code
Code:
<form action="insert.php" method="post">
<input class="cleardefault" value="Example" style="color:#CCC; width:300px; margin: 0 0 10px 0" type="text" name="name"/> <br>
<input class="cleardefault" value="Example" style="color:#CCC; width:300px; margin: 0 0 10px 0" type="text" name="location"/> <br>
<input class="cleardefault" value="Example 400 per Person excluding Fare" style="color:#CCC; width:300px; margin: 10px 0 10px 0" type="text" name="budget"/> <br>
<textarea style="color:#CCC; margin: 0 0 10px 0; width: 300px;" name="addinfo" onfocus="if (this.value==this.defaultValue) this.value=''; this.style.color='#000000';" onblur="if (this.value.replace(/\s/g,'')=='') this.value=this.defaultValue; this.style.color='#CCC'">Example</textarea>
<textarea style="color:#CCC; margin: 0 0 10px 0; width: 300px;" name="howtoget" onfocus="if (this.value==this.defaultValue) this.value=''; this.style.color='#000000'" onblur="if (this.value.replace(/\s/g,'')=='') this.value=this.defaultValue; this.style.color='#CCC'">Example</textarea>
<textarea style="color:#CCC; margin: 0 0 10px 0; width: 300px;" name="missed" onfocus="if (this.value==this.defaultValue) this.value=''; this.style.color='#000000'" onblur="if (this.value.replace(/\s/g,'')=='') this.value=this.defaultValue; this.style.color='#CCC'"></textarea> <br>
<br/>
<input align="right" type="submit" name="submit" value="Add" />
</form>
mao n akong js nga code pra clear rman n cya..
Code:
/*
* Clear Default Text: functions for clearing and replacing default text in
* <input> elements.
*
*/
addEvent(window, 'load', init, false);
function init() {
var formInputs = document.getElementsByTagName('input');
for (var i = 0; i < formInputs.length; i++) {
var theInput = formInputs[i];
if (theInput.type == 'text' && theInput.className.match(/\bcleardefault\b/)) {
/* Add event handlers */
addEvent(theInput, 'focus', clearDefaultText, false);
addEvent(theInput, 'blur', replaceDefaultText, false);
/* Save the current value */
if (theInput.value != '') {
theInput.defaultText = theInput.value;
}
}
}
}
function clearDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == target.defaultText) {
target.value = '';
target.style.color='#000000';
}
}
function replaceDefaultText(e) {
var target = window.event ? window.event.srcElement : e ? e.target : null;
if (!target) return;
if (target.value == '' && target.defaultText) {
target.value = target.defaultText;
target.style.color='#CCC';
}
}