Zapcat
09-17-2002, 04:13 PM
Hi everyone!
I'm creating a site for selling car number plates, part of which will allow the user to enter the number plate letters & numbers they want and see a gif image of what it will look like.
I've put together some jscript to replace a transparent image with the character they type into a text box. So if they put in 'F' an image of the letter F appears on the plate. They can have up to 8 characters.
The problem is I keep getting the 'Object doesn't support this property or method' error message. Here's the jscript I'm using -
function addChars(evt, fld) {
var code = (window.Event) ? evt.which : evt.keyCode;
var char = String.fromCharCode(code);
if(char >= "0" && char <= "9"
|| char >= "A" && char <= "Z") {
document.getElementById("imgLet"+(fld.value.length)).src = String.toLowerCase(char) + ".gif";
}
return true;
}
The HTML code for the text box on the page is -
<input name="regPlate" size="14" maxlength="8" onKeyup="return addChars(event,this);">
Each image has a tag 'imgLet1', 'imgLet2' and so on up to 8.
Can anyone let me know where I'm going wrong?
I'm creating a site for selling car number plates, part of which will allow the user to enter the number plate letters & numbers they want and see a gif image of what it will look like.
I've put together some jscript to replace a transparent image with the character they type into a text box. So if they put in 'F' an image of the letter F appears on the plate. They can have up to 8 characters.
The problem is I keep getting the 'Object doesn't support this property or method' error message. Here's the jscript I'm using -
function addChars(evt, fld) {
var code = (window.Event) ? evt.which : evt.keyCode;
var char = String.fromCharCode(code);
if(char >= "0" && char <= "9"
|| char >= "A" && char <= "Z") {
document.getElementById("imgLet"+(fld.value.length)).src = String.toLowerCase(char) + ".gif";
}
return true;
}
The HTML code for the text box on the page is -
<input name="regPlate" size="14" maxlength="8" onKeyup="return addChars(event,this);">
Each image has a tag 'imgLet1', 'imgLet2' and so on up to 8.
Can anyone let me know where I'm going wrong?