vijk2001
09-11-2002, 08:02 PM
I have the following script:.
(given to me on this site..)
My requirement is : I have two Text edit fields...
If LinkName >=4 chars then Linkcode should automatically be the first 4 chars.
If LinkName < 4 chars then LinkCode should be LinkName PLUS appended O after it.
So i want LinkCode to be automatically ,dynamically populated
But in below code nothing happens..I click Submit and nothing ..why.....btw...txt shd be LinkCode.
<script>
function chk_len(what) {
txt = what.LinkName.value;
if (txt.length>4) {
txt = txt.subString(0,3);
}else{
while (txt.length<4) {
txt += "0";
}
}
return true;
}
</script>
Vij
<form onSubmit="chk_len(this);">
(given to me on this site..)
My requirement is : I have two Text edit fields...
If LinkName >=4 chars then Linkcode should automatically be the first 4 chars.
If LinkName < 4 chars then LinkCode should be LinkName PLUS appended O after it.
So i want LinkCode to be automatically ,dynamically populated
But in below code nothing happens..I click Submit and nothing ..why.....btw...txt shd be LinkCode.
<script>
function chk_len(what) {
txt = what.LinkName.value;
if (txt.length>4) {
txt = txt.subString(0,3);
}else{
while (txt.length<4) {
txt += "0";
}
}
return true;
}
</script>
Vij
<form onSubmit="chk_len(this);">