Hello,
I have the following javascript code:
andCode:<script type="text/javascript"> function key(){ var text = document.getElementById("name"); var res1 = text.value.replace(/&/g, ","); var res2 = res1.replace(/&/g, ","); var res3 = res2.replace(/ /g,","); document.getElementById("key").value = res3; } </script>
Everthing is ok unless I put the HTML inside <form> tags.HTML Code:<input id=name type=text name=name value="a&b"> <input id=key type=text name=key value=""> <input type='button' onclick="key()" value='check'>
So the above code is working but the below code:
generates a "Object doesn't support this property or method" error.HTML Code:<form> <input id=name type=text name=name value="a&b"> <input id=key type=text name=key value=""> <input type='button' onclick="key()" value='check'> </form>
Why? What am I doing wrong and how can I correct it?
Thank you


Reply With Quote

Bookmarks