Avatar of mmichrin
mmichrin asked on

javascript on older version of pocketpc

I am trying to write a javascript that zeros out input fields when a button is pressed.  This code works fine in my development system, but when I try to hit the site from pocket PC (Version 4.20.0), I get an error indicating:
Microsoft JScript runtime error
Line 3: Character: 0
Error: Object doesn't support this property or method
Source: (null)

I have tried many variations, but I believe I may be having problems because the level of DOM supported is 3.02.  Can anyone give me pointers on how to make this script work on this version of DOM?

Sorry, updating the pocket PC version is not an option... :(
<script type="text/javascript">
function zeroit(doc){
    doc.all['form1:tableEx2:0:text5'].value="0";
    doc.all['form1:tableEx2:1:text5'].value="0";
    doc.all['form1:tableEx2:2:text5'].value="0";
    doc.all['form1:tableEx2:3:text5'].value="0";
    doc.all['form1:tableEx2:4:text5'].value="0";
    doc.all['form1:tableEx2:5:text5'].value="0";
    doc.all['form1:tableEx2:6:text5'].value="0";
    doc.all['form1:tableEx2:7:text5'].value="0";
    doc.all['form1:tableEx2:8:text5'].value="0";
    doc.all['form1:tableEx2:9:text5'].value="0";
    doc.all['form1:tableEx2:10:text5'].value="0";
    doc.all['form1:tableEx2:11:text5'].value="0";
    doc.all['form1:tableEx2:12:text5'].value="0";
    doc.all['form1:tableEx2:13:text5'].value="0";
    doc.all['form1:tableEx2:14:text5'].value="0";
}
</script>
 
<hx:commandExButton type="submit" value="Fill with zeros" styleClass="largeCommandExButton" id="button1" onclick="zeroit(this.document)" ></hx:commandExButton>

Open in new window

Smartphone ProgrammingJavaScript

Avatar of undefined
Last Comment
Michel Plungjan

8/22/2022 - Mon
Badotz

Any chance you can use DOM methods for this? Something like:

document.getElementById('form1.tableEx2.0.text5').value = '0';

What is the value of "doc"?
ASKER
mmichrin

doc has the value of this.document.

Unfortunately, getElementById is newer than DOM3, so it ends up not being recognized as a function. :(

I need to hear from someone who wrote Javascript several years ago...like the 90s...DOM 3 is for Internet Explorer 3!
gandalf97

I'm having a similar problem.  Did you ever figure this out?
Experts Exchange is like having an extremely knowledgeable team sitting and waiting for your call. Couldn't do my job half as well as I do without it!
James Murphy
ASKER CERTIFIED SOLUTION
mmichrin

Log in or sign up to see answer
Become an EE member today7-DAY FREE TRIAL
Members can start a 7-Day Free trial then enjoy unlimited access to the platform
Sign up - Free for 7 days
or
Learn why we charge membership fees
We get it - no one likes a content blocker. Take one extra minute and find out why we block content.
See how we're fighting big data
Not exactly the question you had in mind?
Sign up for an EE membership and get your own personalized solution. With an EE membership, you can ask unlimited troubleshooting, research, or opinion questions.
ask a question
Michel Plungjan

This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.