ajaikumarr Posted January 12, 2004 Posted January 12, 2004 Hai, I've a Windows Forms with a Button and AxWebBrowser, and i've loaded AxWebBrowser with a dynamic HTML page (with a javascript function). My problem is, How do i invoke javascript by clicking on the button which is available on Windows forms. (i've tried some thing but no joy...) Sample HTML Code --------------------- <html> <head> <script language=javascript> function somefunction() { alert ("Function sucessfully executed..."); } </script> </head> <body> bla....bla... </body> </html> in VB.NET ------------ AxWebBrowser.Document.ParentWindow.execScript("somefunction()", "JScript") Thanks in advance Ajai Kumar .R Quote
Leaders dynamic_sysop Posted January 12, 2004 Leaders Posted January 12, 2004 brWeb.Navigate("javascript:somefunction()") your browser's name where it says brWeb , and assuming the javascript is within the current window of the browser. Quote
ajaikumarr Posted January 13, 2004 Author Posted January 13, 2004 Axwebbrowser + Javascript Hai dynamic_sysop, Thanks a lot. It's working fine. Thanks again, Ajai Kumar .R Quote
hamid Posted April 25, 2006 Posted April 25, 2006 do i can set my string value to some javascript code and run it by this command? like as: strnig mycode="alert('i am a string')"; brWeb.Navigate("javascript:"+mycode) Quote [ once4ever ]
Leaders snarfblam Posted April 25, 2006 Leaders Posted April 25, 2006 It should work with any valid java-script code in the string. The easiest way to find out, though, is to try for yourself and see if it works. Quote [sIGPIC]e[/sIGPIC]
bcorrea Posted October 8, 2006 Posted October 8, 2006 how to send a javascript objet to a function Hi, what if the function to call, has a parameter ((this) like this: onclick="Myfunction(this);" how can i call this from vb.net? im using the Navigate method, but cannot send the object since it doesnt have an id or name property... TKS! Quote
Gill Bates Posted October 8, 2006 Posted October 8, 2006 Instead of passing "this" you simply reference the object in some way with document.getElementById(...) or something similar like document.window, etc. Quote
bcorrea Posted October 8, 2006 Posted October 8, 2006 Instead of passing "this" you simply reference the object in some way with document.getElementById(...) or something similar like document.window' date=' etc.[/quote'] being tr a table row with a click funtion, that receives an object this, and tr, not having an id or name property, how can i pass the obejct to the js function, using something like the following line of code in vb.net? WebBrowser.Navigate("javascript:MyFunction(" & tr & '');") TKS! Quote
Gill Bates Posted October 9, 2006 Posted October 9, 2006 give the <tr> tag an id and then call document.getElementById("theTR") Quote
bcorrea Posted October 10, 2006 Posted October 10, 2006 The problem is that i dont have access to the website ... i have to work with this TR without an id or name and have to do this click function inside it... Quote
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.