Link to home
Start Free TrialLog in
Avatar of sarah81
sarah81

asked on

How to get pointer to a DHTML created element in MSHTML???

Hi,
I have a web page that creates an input box when clicked on the cell of a table. THe html is like this:

<table><tr><td><span id='mytag' onclick='myfunc(this')/>
</td></tr></table>

<script language='javasript'>
function myfunc(element)
{
    element.parentElement.innerHTML="<input id='mytag'></input>";
}


This creates the input element when I click on the span tag. Now what I want is to access this input element from MSHTML.
I have a window in which I have embedded a browser control. When I load the page in the browser, obviously  there is no input element, so I cant access it. But after I have clicked on the span tag, the input element is created. calling get_document->get_all->item("mytag"), doesnt return pointer to the DHTML created input element. I go on getting the pointer to the span tag.

What should I do to get pointer to the Input tag that got created as a result of onclick event??

Thanks in advance,
Sarah.
Avatar of Havin_it
Havin_it

Not sure if this alone will solve your problem, but in your code above, the span and the dynamically-created input have the same ID. That's gonna cause problems...
ASKER CERTIFIED SOLUTION
Avatar of texascatch
texascatch

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of sarah81

ASKER

no the problem here is that the HTML must have both span and input tags with the same name, else there is no way to recognize the new input box.

may be this wasnt the right place to post this question but i didnt find any topic area where i could post questions related to MSHTML.

and yeah u r right, 2 elements with same name can be accessed thru a collecton and thats what i have done.

so well my prob is solved. thanks for ur help anyways.

i cant give u all points for this, but i will give a few to texascatch if there is some way to give some points. is there?
https://www.experts-exchange.com/help.jsp#hi19
this talks about the points..im new here..thank you