ilvanhellovan 0 Newbie Poster

i have code like this
C#:

document = (HTMLDocument)ieInstance.Document;
            HTMLInputElement input = (HTMLInputElement)document.createElement("input");

input.setAttribute("id", "txtRec", 1);
input.setAttribute("type", "hidden",1);   

input.setAttribute("onClick", "return setContentVal()", 1);
input.style.width = "80px";

HTMLDivElement div = (HTMLDivElement)document.getElementById("silverlightControlHost");                 div.appendChild((mshtml.IHTMLDOMNode)input);

the problem is when i use

document.getElementById("txtRec").click();

Javascript:

function setContentVal(){
    alert("Test");
}

the alert from java script function is not show.
and i try to show to message box from C#

MessageBox.Show("Id : " + document.getElementById("txtRec").getAttribute("id", 0) + ", type : " +
    document.getElementById("txtRec").getAttribute("type", 0) + ", onclick : " +
    document.getElementById("txtRec").getAttribute("onClick", 0));  

the result is "id : txtRec, type : hidden, ****onclick : ****"

why could it be?help...

thankss

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.