Problem in Accessing the element by using their IDs.

Hello to Everybody,
It's really good to be here. Got to know so many things
One question is troubling me a lot, it is : Can't we access an element by using their id to set some values to it's attributes through script twice in an application
Scenario :
I made a markup page and filled some values to some of element's attribute using script on markup page loading. First time, it went well and all values were filled, but when I linked this page from some other page, the values didn't get filled and in some application it gave an error that the element ( whose attribute I tried to access ) is null.
The clock in the markup page is 'page' clock.
So please tell whether this action of mine is valid or there is some problem with the simulator.

Thanks in advance
Regards
Azaz



Answer this question

Problem in Accessing the element by using their IDs.

  • Rav3n

    Hi Peter,
    Thanks for the reply.
    But even after trying with setMarkupLoadedHandler(my_function), its not working. The Value are not getting filled.
    Earlier also, the page was getting displayed, but values were not getting filled. I was firing the event on the body of markup when the page time begin = 1s And according to my understanding, if a page is rendered (i.e displayed), the DOM is already filled.
    Please clarify my understanding also.

    Regards
    Azaz



  • DrewM33

    When you do a <link> the page is re-loaded in its initial form; you would have to set the attributes again.

    Also, if you try to access the DOM before the page has loaded, you will get an error -- use setMarkupLoadedHandler(my_function) to ensure that the DOM is ready for use (where my_function is the function that does the work)



  • Amit Glazer

    Can you provide a SMALL example of what isn't working (eg, a couple of nodes of markup and a simplified script)

    Note that changes you make via the XML DOM (versus animated properties) may not show up until you call document.load(); only some things will appear immediately.



  • Problem in Accessing the element by using their IDs.