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
Avatar of Badotz
Badotz
Flag of United States of America image

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"?
Avatar of mmichrin
mmichrin

ASKER

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!
Avatar of gandalf97
gandalf97

I'm having a similar problem.  Did you ever figure this out?
ASKER CERTIFIED SOLUTION
Avatar of mmichrin
mmichrin

Blurred text
THIS SOLUTION IS ONLY AVAILABLE TO MEMBERS.
View this solution by signing up for a free trial.
Members can start a 7-Day free trial and enjoy unlimited access to the platform.
See Pricing Options
Start Free Trial
Avatar of Michel Plungjan
This question has been classified as abandoned and is closed as part of the Cleanup Program. See the recommendation for more details.
JavaScript
JavaScript

JavaScript is a dynamic, object-based language commonly used for client-side scripting in web browsers. Recently, server side JavaScript frameworks have also emerged. JavaScript runs on nearly every operating system and in almost every mainstream web browser.

127K
Questions
--
Followers
--
Top Experts
Get a personalized solution from industry experts
Ask the experts
Read over 600 more reviews

TRUSTED BY

IBM logoIntel logoMicrosoft logoUbisoft logoSAP logo
Qualcomm logoCitrix Systems logoWorkday logoErnst & Young logo
High performer badgeUsers love us badge
LinkedIn logoFacebook logoX logoInstagram logoTikTok logoYouTube logo