Pocket PC 2003 browser - Javascript getElementsByTagName failing

V

vinodbijlani

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
 
M

Martin Honnen

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.
 
V

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.
 
V

vinodbijlani

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
 
V

vinodbijlani

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
 
V

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">Question</a>
and later document.anchors.name and string functions to extract the
right part.

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

vinodbijlani

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
 
V

vinodbijlani

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.type;
if((temp == "radio") && (questionForm.elements.checked)) {
radio_buttonnames[j] = questionForm.elements.name;
radio_buttons[j] = questionForm.elements.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);
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,755
Messages
2,569,537
Members
45,022
Latest member
MaybelleMa

Latest Threads

Top