Velbekom, og tak for point :)
- Afhængig af behovet kan dette være sjovere:
(peter jensen -> Peter Jensen)
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title><meta name="robots" content="index, follow">
<script type="text/javascript">
function upcase(e){
var v=e.value;
v=v.split(" ");
for(var i=0;i<v.length;i++){
if(v[i].length>1)v[i]=v[i].substr(0,1).toUpperCase()+v[i].substr(1).toLowerCase();
}
e.value=v.join(" ");
}
</script>
</head><body>
<input type="text" name="fornavn_efternavn" size="30" onkeyup="upcase(this);" onchange="upcase(this);">
</body></html>
eller blot samlingen af første udgave i et script:
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "
http://www.w3.org/TR/html4/loose.dtd"><html><head><meta http-equiv="content-type" content="text/html; charset=iso-8859-1"><title>Ingen titel</title><meta name="robots" content="index, follow">
<script type="text/javascript">
function upcase(e){
v=e.value;
e.value=v.substr(0,1).toUpperCase()+v.substr(1);
}
</script>
</head><body>
<input type="text" name="fornavn" size="30" onkeyup="upcase(this);" onchange="upcase(this);">
</body></html>