Deepika Shukla
Posts: 11
Joined: 2011-02-11
|
Hi Team!
Please help me out of the strange problem I am facing. I want to display tab orders on the web-page and for this I want to execute a JavaScript function on the button click of my toolbar. But I am getting ?Â?Ð?ìException from HRESULT: 0x80020101?Â?Ð?í
I came through your site http://www.add-in-express.com/support/addin-c-sharp.php#internet-explorer
And found the topic ?Â?Ð?ìHow to run and replace a script (JavaScript, JScript or VBScript) on an HTML page in IE 6 or 7?Â?Ð?í,downloaded the sample(also Attached with this mail) you have provided and when I make it run I again got following error:
See the end of this message for details on invoking
Just-in-time (JIT) debugging instead of this dialog box.
************** Exception Text **************
System.Runtime.InteropServices.COMException (0x80020101): Exception from HRESULT: 0x80020101
at mshtml.HTMLWindow2Class.IHTMLWindow2_execScript(String code, String language)
at MyIEAddon6.MyIEToolBar1.button1_Click(Object sender, EventArgs e) in C:\Documents and Settings\Deepika.Shukla\My Documents\Downloads\AutoCompletee\PDFextractor\ie-runtime-scripting-vs2005cs\MyIEAddon6\MyIEToolBar1.cs:line 113
at System.Windows.Forms.Control.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnClick(EventArgs e)
at System.Windows.Forms.Button.OnMouseUp(MouseEventArgs mevent)
at System.Windows.Forms.Control.WmMouseUp(Message& m, MouseButtons button, Int32 clicks)
at System.Windows.Forms.Control.WndProc(Message& m)
at System.Windows.Forms.ButtonBase.WndProc(Message& m)
at System.Windows.Forms.Button.WndProc(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.OnMessage(Message& m)
at System.Windows.Forms.Control.ControlNativeWindow.WndProc(Message& m)
at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)
************** JIT Debugging **************
To enable just-in-time (JIT) debugging, the .config file for this
application or computer (machine.config) must have the
jitDebugging value set in the system.windows.forms section.
The application must also be compiled with debugging
enabled.
For example:
<configuration>
<system.windows.forms jitDebugging="true" />
</configuration>
When JIT debugging is enabled, any unhandled exception
will be sent to the JIT debugger registered on the computer
rather than be handled by this dialog box.
Please help me out of this error!
It?Â?Ð?és very urgent.
Thanks!
Deepika
[COLOR=red][COLOR=red][FONT=Impact] |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Deepika.
In the example, you need to press the ?Â?Ð?èReplace the Script?Â?Ð?é button before you run the test script. Also, you need to open a web page with scripts, e.g. www.google.com. Please test it again. |
|
Deepika Shukla
Posts: 11
Joined: 2011-02-11
|
Thanks Sergey! It worked! |
|
Deepika Shukla
Posts: 11
Joined: 2011-02-11
|
Hi Team!
Thanks for the quick reply! The test project is working fine. But can you please help me out of the problem I am facing.
I want to display tab orders on the web-page and for this I want to execute a JavaScript function on the button click of my toolbar.
I am getting ?Â?Ð?ìException from HRESULT: 0x80020101?Â?Ð?í
The code is as follows :
private void button2_Click(object sender, EventArgs e)
{
mshtml.HTMLDocument doc = this.HTMLDocument;
if (doc != null)
{
mshtml.IHTMLElementCollection elementCollection1 = doc.getElementsByTagName("script");
if (elementCollection1 != null)
{
for (int i = 0; i < elementCollection1.length; i++)
{
mshtml.IHTMLScriptElement scriptElement = elementCollection1.item(i, i) as mshtml.IHTMLScriptElement;
if (scriptElement != null)
{
if (scriptElement.text != null)
{
X scriptElement.text = "function taborder(){var b=0;t=document.getElementsByTagName('*');{ for(i=0;i<t.length;i++) {if(t[i].tagName.toLowerCase()=='a'&&t[i].innerHTML!=''||t[i].tagName.toLowerCase()=='iframe'||t[i].tagName.toLowerCase()=='object'||(t[i].tagName.toLowerCase()=='input'&&t[i].type!='hidden')||t[i].tagName.toLowerCase()=='textarea'||t[i].tagName.toLowerCase()=='select'||(t[i].tagName.toLowerCase()=='img'&&t[i].useMap)){if (t[i].tabIndex) { if (t[i].tabIndex>b||t[i].tabIndex==b) { b=t[i].tabIndex; } }} }for(i=0;i<t.length;i++) { if((t[i].tagName.toLowerCase()=='a'&&(t[i].innerHTML!=''||t[i].href!='')||t[i].tagName.toLowerCase()=='iframe'||t[i].tagName.toLowerCase()=='object'||(t[i].tagName.toLowerCase()=='input'&&t[i].type!='hidden')||t[i].tagName.toLowerCase()=='textarea'||t[i].tagName.toLowerCase()=='select'||(t[i].tagName.toLowerCase()=='img'&&t[i].useMap))&&!t[i].tabIndex) { b+=1; t[i].insertAdjacentHTML('AfterEnd','<span st yle='color:red;background:#ffefd5;font:bold .8em arial;padding:4px;'><strong>'+b+'</strong></span>'); t[i].style.border='1px dashed red'; if (t[i].parentNode.style.display=='none'){ t[i].parentNode.style.display='block'} } }}}";
}
Marshal.ReleaseComObject(scriptElement);
}
}
Marshal.ReleaseComObject(elementCollection1);
}
}
}
Thanks!
Deepika |
|
Sergey Grischenko
Add-in Express team
Posts: 7233
Joined: 2004-07-05
|
Hi Deepika.
Probably you just need to add a new script instead of replacing all scripts on the web page.
You can also rewrite the script in C# and call the C# code from the event handler of the button. |
|