Page is a not externally linkable
- Code, Content, and Presentation
-- JavaScript and AJAX
---- Variable scope and functions


le_gber - 4:41 pm on May 8, 2009 (gmt 0)


whoisgregg thanks for your reply.

I needed i because part of my function also checks the form default value array against it.

a more complete version of the function would be:
window.onload = function(){
if(document.getElementById('myform')){
ffields = document.getElementById('myform').getElementsByTagName('input');
var formDefaultVal = new Array("name", "surname","email");
for(f in ffields){
ffields[i].onclick = function(){ if(this.value==smallFormVal[i]){ this.value=''; }}
ffields[i].onblur= function(){ if(this.value==''){ this.value=smallFormVal[i]; }}
}
}
}

if(this.value==''){ this.value=smallFormVal[f]; }


Thread source:: http://www.webmasterworld.com/javascript/3909506.htm
Brought to you by WebmasterWorld: http://www.webmasterworld.com