c#.net Webbrowser 控件锚标记调用单击事件不适用于备用行

发布于 2024-12-22 22:39:20 字数 2063 浏览 1 评论 0原文

我正在使用 c#.net 和 webbrowsercontrol。 我正在调用锚标记的点击事件。

应用程序具有以下代码:

HtmlElementCollection anchors = browser.Document.GetElementsByTagName("a");
foreach (HtmlElement anc in anchors)
   { 
   if(anc.GetAttribute("href").ToLower().Contains("javascript:PFA".ToLower())
      {
       anc.InvokeMember("click");
      }
   }

它适用于一行,不适用于另一行。
来源网站有以下:

                            <td colspan="1" id="tdborder" align="left" width="5%">
                            <input  name="appsWithStatusChg" type="checkbox"   id="appsWithStatusChg1" alt='checkBoxLabel1'
                            label='checkBoxLabel1' 
                            value="12114831" >
                            </td>                       


                            <td width="10%">

                            <a class="PairLink" tabindex="17" href="javascript:postForApplicationData('12114831')">
                            12/114,831



                            </td>
                            <td width="10%"> -</td>
                            <td width="14%"> US 2008-0209452 A1</td>
                            <td width="14%"> 1133-112US02</td>
                            <td width="11%"> 98449</td>
                            <td width="9%"> 12-24-2011</td>
                            <td width="17%"> 05-05-2008</td>
                            <td width="8%">




                            <!--<input type="button" name="submitForIFW" value="Review" id="submitForIFW" onClick="postForIFWData('12114831')" tabindex="9" >
                            -->
                            <a href="javascript:postForIFWData('12114831')" tabindex="9"> View</a>




                            </td>
                        </tr>

问题是当我们尝试调用点击事件时 对于 tr 为 wpsTableShdRow 的锚标记不起作用。 tr 为 wpsTableNrmRow 的锚标记正在工作。

当我们尝试手动访问单击事件时,它会起作用。

I am using c#.net and webbrowsercontrol.
I am invoking click event of anchor tag.

Application has following code:

HtmlElementCollection anchors = browser.Document.GetElementsByTagName("a");
foreach (HtmlElement anc in anchors)
   { 
   if(anc.GetAttribute("href").ToLower().Contains("javascript:PFA".ToLower())
      {
       anc.InvokeMember("click");
      }
   }

It works for one row and not for the other row.
Source Website has following :

                            <td colspan="1" id="tdborder" align="left" width="5%">
                            <input  name="appsWithStatusChg" type="checkbox"   id="appsWithStatusChg1" alt='checkBoxLabel1'
                            label='checkBoxLabel1' 
                            value="12114831" >
                            </td>                       


                            <td width="10%">

                            <a class="PairLink" tabindex="17" href="javascript:postForApplicationData('12114831')">
                            12/114,831



                            </td>
                            <td width="10%"> -</td>
                            <td width="14%"> US 2008-0209452 A1</td>
                            <td width="14%"> 1133-112US02</td>
                            <td width="11%"> 98449</td>
                            <td width="9%"> 12-24-2011</td>
                            <td width="17%"> 05-05-2008</td>
                            <td width="8%">




                            <!--<input type="button" name="submitForIFW" value="Review" id="submitForIFW" onClick="postForIFWData('12114831')" tabindex="9" >
                            -->
                            <a href="javascript:postForIFWData('12114831')" tabindex="9"> View</a>




                            </td>
                        </tr>

Problem is that when we try to invoke click event
for anchor tag whose tr is wpsTableShdRow is not working.
anchor tag whose tr is wpsTableNrmRow is working.

when we try to access click event manually it works.

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

信仰 2024-12-29 22:39:20
HtmlElementCollection anchors = browser.Document.GetElementsByTagName("a");
foreach (HtmlElement anc in anchors)
   { 
   if(anc.GetAttribute("href").Contains("javascript:postForIFWData('12114831')"))
      {
       anc.InvokeMember("click");
      }
   }
HtmlElementCollection anchors = browser.Document.GetElementsByTagName("a");
foreach (HtmlElement anc in anchors)
   { 
   if(anc.GetAttribute("href").Contains("javascript:postForIFWData('12114831')"))
      {
       anc.InvokeMember("click");
      }
   }
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文