Sign in with
Sign up | Sign in
Your question

Why won't my Javascript work with PIE ?

Last response: in Cell Phones & Smartphones
Share
Anonymous
July 5, 2005 8:10:02 AM

Archived from groups: microsoft.public.pocketpc (More info?)

I'm trying to build a simple site for pocket PC for a concept demonstrator to
load an audio stream. It works fine in IE on the Pc but throws up 'line:4
char:1 object doesn't support property or method' when I try it on a pocket
PC. The handheld is a rather antiquated HP jornada running PocketPC 3.012039.
I can't find any details of the PIE version. Hopefully this is simple to
solve - I've not really used handheld devices much before.

Thanks all,

Chris

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html>
<head>
<script type="text/javascript">
function trafficfm()
{
var area=document.getelementbyid("regionSelect")
//alert(area.selectedIndex)
var data=document.getelementeyid("qualitySelect")
//alert(data.selectedIndex)
if (data.selectedIndex==0)
{
switch(area.selectedIndex)
{
case 0:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
case 1:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
case 2:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
case 3:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
case 4:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
default:
window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
break
}
}
else
{
switch(area.selectedIndex)
{
case 0:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
case 1:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
case 2:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
case 3:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
case 4:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
default:
window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
break
}

}
}
</script>
<link rel="stylesheet" type="text/css" href="ce.css" media="handheld" />
</head>
<body>
<img id="logo" src="images/solid_logo.gif"/>
<h1>Internet Radio Trial</h1>
<div id="pda_select">
<h2>Select a Region and Quality</h2>
<form>
<select id="regionSelect">
<option>North East</option>
<option>North West</option>
<option>Midlands</option>
<option>South West</option>
<option>South East</option>
</select>
<select id="qualitySelect">
<option>High</option>
<option>Low</option>
</select>
<input type="button" value="Go!" name="listen" onclick="trafficfm()"/>
</form>
</div><!--pda_select-->
</body>
</html>

More about : javascript work pie

Anonymous
July 6, 2005 4:17:44 AM

Archived from groups: microsoft.public.pocketpc (More info?)

PIE uses a very limited subset of Javascript called JScript. Perhaps you
should have a look at MSDN:

http://msdn.microsoft.com/library/default.asp?url=/libr...

(link may need Copy&Paste).

There's a design overview and you probably will have to investigate
alternatives to implement what you want.

Also, I'd say you're running Pocket PC OS 2002, which may not support
everything you need. You could look on MSDN for the stand alone emulator and
try your pages on that instead.

--
Mauricio Freitas, Microsoft MVP Mobile Devices
http://www.geekzone.co.nz
Bluetooth guides: http://www.geekzone.co.nz/content.asp?contentid=449
Software for Pocket PC and Smartphone: http://www.geekzone.co.nz/store
Software for Pocket PC directly on your device:
http://www.geekzone.co.nz/inhand.asp




"Chris_h" <Chrish@discussions.microsoft.com> wrote in message
news:0CF81BA6-2447-455E-B515-9ABE88F81C7F@microsoft.com...
> I'm trying to build a simple site for pocket PC for a concept demonstrator
> to
> load an audio stream. It works fine in IE on the Pc but throws up 'line:4
> char:1 object doesn't support property or method' when I try it on a
> pocket
> PC. The handheld is a rather antiquated HP jornada running PocketPC
> 3.012039.
> I can't find any details of the PIE version. Hopefully this is simple to
> solve - I've not really used handheld devices much before.
>
> Thanks all,
>
> Chris
>
> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> <html>
> <head>
> <script type="text/javascript">
> function trafficfm()
> {
> var area=document.getelementbyid("regionSelect")
> //alert(area.selectedIndex)
> var data=document.getelementeyid("qualitySelect")
> //alert(data.selectedIndex)
> if (data.selectedIndex==0)
> {
> switch(area.selectedIndex)
> {
> case 0:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> case 1:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> case 2:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> case 3:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> case 4:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> default:
> window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> break
> }
> }
> else
> {
> switch(area.selectedIndex)
> {
> case 0:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> case 1:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> case 2:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> case 3:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> case 4:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> default:
> window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> break
> }
>
> }
> }
> </script>
> <link rel="stylesheet" type="text/css" href="ce.css" media="handheld" />
> </head>
> <body>
> <img id="logo" src="images/solid_logo.gif"/>
> <h1>Internet Radio Trial</h1>
> <div id="pda_select">
> <h2>Select a Region and Quality</h2>
> <form>
> <select id="regionSelect">
> <option>North East</option>
> <option>North West</option>
> <option>Midlands</option>
> <option>South West</option>
> <option>South East</option>
> </select>
> <select id="qualitySelect">
> <option>High</option>
> <option>Low</option>
> </select>
> <input type="button" value="Go!" name="listen" onclick="trafficfm()"/>
> </form>
> </div><!--pda_select-->
> </body>
> </html>
Anonymous
July 6, 2005 4:17:45 AM

Archived from groups: microsoft.public.pocketpc (More info?)

Thankyou for your help, I have used the documentation that you suggest but it
seems to me that the script should get further than line 4 before failing
even if I'm pessimistic about the scripting support available! It generates
an error on the line the script starts on. The browser version does support
the window.location method as I've sucessfully used it previously but I'm
unsure about the document.getelementbyid method. Having said that, even if
this line does fail it should give a different line number in the error
message if this statement was causing the problem. It would be helpful to
have the DOM for this version of the browser but I can only find more recent
ones - any pointers to this information would be gratefully recieved.

Thanks,

Chris

"Mauricio Freitas [MVP]" wrote:

> PIE uses a very limited subset of Javascript called JScript. Perhaps you
> should have a look at MSDN:
>
> http://msdn.microsoft.com/library/default.asp?url=/libr...
>
> (link may need Copy&Paste).
>
> There's a design overview and you probably will have to investigate
> alternatives to implement what you want.
>
> Also, I'd say you're running Pocket PC OS 2002, which may not support
> everything you need. You could look on MSDN for the stand alone emulator and
> try your pages on that instead.
>
> --
> Mauricio Freitas, Microsoft MVP Mobile Devices
> http://www.geekzone.co.nz
> Bluetooth guides: http://www.geekzone.co.nz/content.asp?contentid=449
> Software for Pocket PC and Smartphone: http://www.geekzone.co.nz/store
> Software for Pocket PC directly on your device:
> http://www.geekzone.co.nz/inhand.asp
>
>
>
>
> "Chris_h" <Chrish@discussions.microsoft.com> wrote in message
> news:0CF81BA6-2447-455E-B515-9ABE88F81C7F@microsoft.com...
> > I'm trying to build a simple site for pocket PC for a concept demonstrator
> > to
> > load an audio stream. It works fine in IE on the Pc but throws up 'line:4
> > char:1 object doesn't support property or method' when I try it on a
> > pocket
> > PC. The handheld is a rather antiquated HP jornada running PocketPC
> > 3.012039.
> > I can't find any details of the PIE version. Hopefully this is simple to
> > solve - I've not really used handheld devices much before.
> >
> > Thanks all,
> >
> > Chris
> >
> > <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
> > "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
> > <html>
> > <head>
> > <script type="text/javascript">
> > function trafficfm()
> > {
> > var area=document.getelementbyid("regionSelect")
> > //alert(area.selectedIndex)
> > var data=document.getelementeyid("qualitySelect")
> > //alert(data.selectedIndex)
> > if (data.selectedIndex==0)
> > {
> > switch(area.selectedIndex)
> > {
> > case 0:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > case 1:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > case 2:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > case 3:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > case 4:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > default:
> > window.location="http://217.204.58.75/asx/HA_NAT_Low.asx"
> > break
> > }
> > }
> > else
> > {
> > switch(area.selectedIndex)
> > {
> > case 0:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > case 1:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > case 2:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > case 3:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > case 4:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > default:
> > window.location="http://217.204.58.75/asx/HA_NAT_pda.asx"
> > break
> > }
> >
> > }
> > }
> > </script>
> > <link rel="stylesheet" type="text/css" href="ce.css" media="handheld" />
> > </head>
> > <body>
> > <img id="logo" src="images/solid_logo.gif"/>
> > <h1>Internet Radio Trial</h1>
> > <div id="pda_select">
> > <h2>Select a Region and Quality</h2>
> > <form>
> > <select id="regionSelect">
> > <option>North East</option>
> > <option>North West</option>
> > <option>Midlands</option>
> > <option>South West</option>
> > <option>South East</option>
> > </select>
> > <select id="qualitySelect">
> > <option>High</option>
> > <option>Low</option>
> > </select>
> > <input type="button" value="Go!" name="listen" onclick="trafficfm()"/>
> > </form>
> > </div><!--pda_select-->
> > </body>
> > </html>
>
>
>
Related resources
Anonymous
July 6, 2005 4:17:46 AM

Archived from groups: microsoft.public.pocketpc (More info?)

On Tue, 5 Jul 2005 05:56:07 -0700, "Chris_h"
<Chrish@discussions.microsoft.com> wrote:

>Thankyou for your help, I have used the documentation that you suggest but it
>seems to me that the script should get further than line 4 before failing
>even if I'm pessimistic about the scripting support available! It generates

No, because PIE doesn't correctly support DOM. So if this line was

var area=document.getelementbyid("regionSelect")

You should try to use the document object instead :

var area=document.regionSelect;

PS document.getelementbyid would fail in *any* browser, Javascript is
case sensitive and it should read document.getelementById with the
correct capitalisation.

So you haven't got error reporting turned on in IE/PC, and you're not
looking at the javascript console in Firefox either !

>an error on the line the script starts on. The browser version does support
>the window.location method as I've sucessfully used it previously but I'm
>unsure about the document.getelementbyid method. Having said that, even if
>this line does fail it should give a different line number in the error
>message if this statement was causing the problem.

You're mistaken. Javascript interpreters count newlines from and
including the script tag. So line 4 is correct ;-)

> It would be helpful to have the DOM for this version of the browser

It doesn't support HTML DOM (though WM2003 PIE *does* support XML DOM
;-)

HTH
Cheers - Neil
Anonymous
July 6, 2005 4:17:47 AM

Archived from groups: microsoft.public.pocketpc (More info?)

On Tue, 05 Jul 2005 13:22:35 GMT, "Neil Smith [MVP Digital Media]"
<neil@nospam.com> wrote:

>PS document.getelementbyid would fail in *any* browser, Javascript is
>case sensitive and it should read document.getelementById with the
>correct capitalisation.

Hah ! Now I'm doing it : document.getElementById is of course the
correct capitalisation :-P

Cheers - Neil
Anonymous
July 6, 2005 4:17:47 AM

Archived from groups: microsoft.public.pocketpc (More info?)

Thanks very much Neil, hopefully that'll solve my problems. The lowercase
method does seem to work in PC browsers but the reason I did it this way was
because this
http://msdn.microsoft.com/library/default.asp?url=/libr... says that JScript is not case sensitive.

Thanks again,

Chris
Anonymous
July 6, 2005 4:17:47 AM

Archived from groups: microsoft.public.pocketpc (More info?)

Works like a charm. Many thanks,
Chris
Anonymous
July 6, 2005 4:17:47 AM

Archived from groups: microsoft.public.pocketpc (More info?)

Spoke to soon, having used var area=document.regionSelect, how do I then
access the selectedIndex property of regionSelect? At the moment, I am told
that selectedIndex is Null or not an object. I didn't notice that it wasn't
working as it fell through to the default of my switch statement!

Cheers again,

Chris
Anonymous
July 6, 2005 4:17:48 AM

Archived from groups: microsoft.public.pocketpc (More info?)

On Tue, 5 Jul 2005 09:06:17 -0700, "Chris_h"
<Chrish@discussions.microsoft.com> wrote:

>Spoke to soon, having used var area=document.regionSelect, how do I then
>access the selectedIndex property of regionSelect? At the moment, I am told
>that selectedIndex is Null or not an object. I didn't notice that it wasn't
>working as it fell through to the default of my switch statement!

Bugger, probably broken PIE again. Instead, try the forms collection :

document.forms[0].regionSelect.selectedIndex;

If you have named your form <form name="myform"> or you think you'll
end up having multiple forms in varying places in the HTML, you can
also use

document.forms["myform"].regionSelect.selectedIndex;

HTH
Cheers - Neil
Anonymous
July 6, 2005 5:45:01 AM

Archived from groups: microsoft.public.pocketpc (More info?)

Unfortunately that doesn't work either. Should regionSelect be the name or
the id of the SELECT element? It seems to work both ways in IE6 but not
at-all in PIE! Do you have any more suggestions that I could try?

Thanks for all your help so far!

Chris
Anonymous
July 6, 2005 6:42:03 AM

Archived from groups: microsoft.public.pocketpc (More info?)

After a bit of random mucking about,
document.myform.regionSelect.selectedIndex seems to work in IE6 and PIE. I'm
not sure if this is a 'standard' construction or not - I've only been using
Javascript of any description for a week!

Cheers,
Chris

"Neil Smith [MVP Digital Media]" wrote:

> On Tue, 5 Jul 2005 09:06:17 -0700, "Chris_h"
> <Chrish@discussions.microsoft.com> wrote:
>
> >Spoke to soon, having used var area=document.regionSelect, how do I then
> >access the selectedIndex property of regionSelect? At the moment, I am told
> >that selectedIndex is Null or not an object. I didn't notice that it wasn't
> >working as it fell through to the default of my switch statement!
>
> Bugger, probably broken PIE again. Instead, try the forms collection :
>
> document.forms[0].regionSelect.selectedIndex;
>
> If you have named your form <form name="myform"> or you think you'll
> end up having multiple forms in varying places in the HTML, you can
> also use
>
> document.forms["myform"].regionSelect.selectedIndex;
>
> HTH
> Cheers - Neil
>
Anonymous
July 6, 2005 2:22:49 PM

Archived from groups: microsoft.public.pocketpc (More info?)

On Wed, 6 Jul 2005 02:42:03 -0700, "Chris_h"
<Chrish@discussions.microsoft.com> wrote:

>After a bit of random mucking about,

Yeah I'd get used to that ;-)

>document.myform.regionSelect.selectedIndex seems to work in IE6 and PIE. I'm
>not sure if this is a 'standard' construction or not - I've only been using
>Javascript of any description for a week!

Well I'd say you're doing pretty well, nice work
Cheers - Neil
!