I found the problem. Your example DOES work, but not if the <SCRIPT> is in the <HEAD>. I believe what happens is that this function is loaded prior to the elements existing.
I moved this snippet to the BOTTOM of the file; after the </HTML> and it worked. Likely because the elements finally do exist so the onChange assignment acutally gets set.
Thanks!
- Matt...
User Profile
Collapse
-
-
Javascript: set an onChange function by javascript, not embedded.
I have an HTML file that includes a JavaScript. I would like this JavaScript to be able to create an "onChange=<func tion>" attribute against the password element.
Here is an example page of the onChange embedded in the "password" field. This is normal HTML and it works fine.
...Code:<HTML> <HEAD><TITLE> Example of onChange Event Handler </TITLE> </HEAD>
No activity results to display
Show More
Leave a comment: