W
weston
Maybe I just need another pair of eyes or two, but it really seems as
if document.getElementById is choking on me. This page:
http://www.mortgageplans.com/mbc-network/enroll.html?EC=245
has an input form field coded like so:
<input id="enrollCodeField" type="text" name="Code" value="" size="9"/>
And I've got the following javascript, which tries to get a reference
to that element and change its value:
x = document.getElementById('enrollCodeField');
if(x) x.value = ec;
else alert('Can\'t find the input given id="enrollCodeField"');
(The whole script context can be found at
http://www.mortgageplans.com/javascript/refcode.js )
The above code always seems to trigger the alert, meaning....
document.getElementById('enrollCodeField') apparently isn't retrieving
a reference to the input element id'd as enrollCodeField. I can't see
any apparent reason for this.
Oddly enough, if I call the Javascript Shell Bookmarklet
(http://www.squarefree.com/shell/ ) on that page, and type in
document.getElementById('enrollCodeField'), it works as expected.
Any idea what I'm missing here?
Thanks,
Weston
if document.getElementById is choking on me. This page:
http://www.mortgageplans.com/mbc-network/enroll.html?EC=245
has an input form field coded like so:
<input id="enrollCodeField" type="text" name="Code" value="" size="9"/>
And I've got the following javascript, which tries to get a reference
to that element and change its value:
x = document.getElementById('enrollCodeField');
if(x) x.value = ec;
else alert('Can\'t find the input given id="enrollCodeField"');
(The whole script context can be found at
http://www.mortgageplans.com/javascript/refcode.js )
The above code always seems to trigger the alert, meaning....
document.getElementById('enrollCodeField') apparently isn't retrieving
a reference to the input element id'd as enrollCodeField. I can't see
any apparent reason for this.
Oddly enough, if I call the Javascript Shell Bookmarklet
(http://www.squarefree.com/shell/ ) on that page, and type in
document.getElementById('enrollCodeField'), it works as expected.
Any idea what I'm missing here?
Thanks,
Weston