How to insert javascript funtion dynamically ?
-
Hi all, I have added IHtmlscriptElement ( a javascript function ) now i want to attach and event for the body tag For example, in the initial ............. Dynamically i want to add as bellow ............. How to add as above Please some one help me thanks in advance
-
Hi all, I have added IHtmlscriptElement ( a javascript function ) now i want to attach and event for the body tag For example, in the initial ............. Dynamically i want to add as bellow ............. How to add as above Please some one help me thanks in advance
-
Hi Friend, thanks, yes i am doing in C# application only if you guide me it will be much helpful for me. thanks again
-
Hi Friend, thanks, yes i am doing in C# application only if you guide me it will be much helpful for me. thanks again
-
hi, from .cs file u can use this I hope this will help u out
Page.ClientScript.RegisterStartupScript(this.GetType(), "alert", "unSelectCheckbox();", true);
Thanks, Amit Patel
Hi Friend, Thank you, I am using web browser control, in windows application, so i get all the HtmlElement like body,form,div etc... from there i want to attache this. have a look at my code
mshtml.IHTMLElementCollection ecol = document.all;//getElementsByTagName("head");
if (ecol != null)
{
foreach (IHTMLElement elmnt in ecol)
{
string str = elmnt.outerText;
int k = 0;
if (elmnt.ToString() == "mshtml.HTMLHeadElementClass")
{
mshtml.IHTMLHeadElement head = (mshtml.IHTMLHeadElement)elmnt;
//mshtml.IHTMLElement se = document.createElement("script");
mshtml.IHTMLScriptElement element = (mshtml.IHTMLScriptElement)document.createElement("script");
//element.text = "alert('here we are')";
element.text ="function EventRaise(){var m = document.activeElement.value;alert(document.activeElement.type);alert('The active element is '+m); }";
IHTMLDOMNode node = (IHTMLDOMNode)element;
document.appendChild(node);} else if (elmnt.ToString() == "mshtml.HTMLBodyClass") { //need to call the EventRaise function } } }
i hope you may have some idea on that... awaiting...