By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
432,248 Members | 882 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 432,248 IT Pros & Developers. It's quick & easy.

Pocket PC 2003 browser - Javascript getElementsByTagName failing

P: n/a
Guys,
I want to access all the <div> tags on my page. below is javascript
which is use to access them
var divs=document.getElementsByTagName("div");

this works on IE but is failing on Pocket PC 2003 browser.

any of guys faced this problem..any work arounds?

thanks for the help

Jul 23 '05 #1
Share this Question
Share on Google+
9 Replies


P: n/a


vi**********@gmail.com wrote:

I want to access all the <div> tags on my page. below is javascript
which is use to access them
var divs=document.getElementsByTagName("div");

this works on IE but is failing on Pocket PC 2003 browser.

any of guys faced this problem..any work arounds?


I guess
var divs = document.all.tags("div")
will do. But that is just a guess I have no pocket pc here to test.
--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2

P: n/a
VK
On Pocket Internet Explorer you can use only directly addressed div's:

<div id="div1"></div>
and later:
div1.innerHTML = "New content";

You have no evident way to get it by id or from a collection.

Actually all pocket browsers is a fancy mixture of IE 3.0, JavaScript
1.0, some (VERY some) DHTML, a bit of CSS and ALWAYS a pretty good XML
parser.

If you really want to program for PDA's, you have a choice: either use
the forgotten lore of all these tricks for 3rd browsers, or program
directly with XML Island.

Jul 23 '05 #3

P: n/a
thanks Martin.
i got a feeling tht PPC 2003 has different IE version.. checked the
User-Agent & it is IE 4.01..

but still document.all.tags("div") is failing ..tried with CAPS
...fails (this should have worked with IE 4)

will try the id way suggested by VK...

any other suggestions
appreciate the help

Jul 23 '05 #4

P: n/a
i m just using the emulator
http://www.microsoft.com/downloads/d...DisplayLang=en

yet to try on real pda ..seems like its goin to be fun

Jul 23 '05 #5

P: n/a
Vk,
these div are built dynamically.
its basically a Question & Answer page (dynamic generation) answers are
radio buttons & checkbox. I need to build the URL to submit the
questions & selected answers for the next page
thanks

Jul 23 '05 #6

P: n/a
FYI,
even this doesnt work
var e1 = document.all[0];
alert(e1);

Jul 23 '05 #7

P: n/a
VK
> even this doesnt work var e1 = document.all[0];

As I told you :-). I have Pocket PC's for 6 year now.

This work though:
....
<div id="que1"></div>
....
que1.innerHTML = newQuestion;

No custom arrays of any kind, sorry (JavaScript 1.0)
You can use native anchors array instead of <div> to hold
question/answers/right answer info:

<a name="Answer1_Answer_2_Answer_3_RightAnswer">Quest ion</a>
and later document.anchors[i].name and string functions to extract the
right part.

Or better to use a data island <xml>data</xml>

Jul 23 '05 #8

P: n/a
VK
thanks for ur reply.

sorry i m not very conversent with data island. how do i use data
island for user input??
radio button ..check box?? can i?

thanks again

Jul 23 '05 #9

P: n/a
thanks for the help guys. fixed the problem. below is the javascript .
form.elements works just fine PPC 2003.

var j = 0;
var radio_buttons = new Array();
var radio_buttonnames = new Array();

for(var i=0; i<questionForm.length; i++){
var temp = questionForm.elements[i].type;
if((temp == "radio") && (questionForm.elements[i].checked)) {
radio_buttonnames[j] = questionForm.elements[i].name;
radio_buttons[j] = questionForm.elements[i].value;
j++;
}
}
alert("created arrays");
for(var k=0; k<radio_buttons.length; k++){
qId=radio_buttonnames[k];
answerId=radio_buttons[k];

queryString=queryString+"responseQuestionId_"+qId+ "="+qId+"&responseAnswerId_"+qId+"="+answerId+ "&";
}

alert(queryString);

Jul 23 '05 #10

This discussion thread is closed

Replies have been disabled for this discussion.