我试图点击表格中的导航链接,但我无法让它工作。我试过了
getElementByID
getElementsByClassName
getElementsByTagName
所有人都空了。
此
Set tbls = HTMLDoc.getElementByID("tabToggleTable")
叶
tbls = Nothing
以下是我正在查看的网站部分(具体为<td title="Provider Accounting Home Page"
):
<html>
<head>
<body onhelp="" onload="sfHomePageLoad();" onresize="">
<div id="pagehider">
<table width="100%" height="100%" border="0" cellSpacing="11" cellPadding="0">
<colgroup>
<tbody>
<tr>
<td id="WorkListsColumn">
<td id="TasksColumn">
<table width="100%" height="100%" class="CUI-Table" cellSpacing="0" cellPadding="5">
<tbody>
<tr height="15" class="CUI-SectionTitleBar">
<tr height="40%" class="CUI-Section">
<td style="border-top-color: #6c8cd9; border-top-width: 1px; border-top-style: solid;">
<table width="100%" height="100%" class="CUI-Table" cellSpacing="0" cellPadding="0">
<tbody>
<tr height="15" class="CUI-SectionTitleBar" style="padding-top: 5px; padding-right: 5px; padding-bottom: 5px; padding-left: 5px;">
<tr height="100%" class="CUI-Section">
<td style="border-top-color: #6c8cd9; border-top-width: 1px; border-top-style: solid;">
<div id="PrimaryTasksGrid" style="width: 682px; height: 326px; overflow: auto;">
<table width="100%" style="background-color: white;" border="0" cellSpacing="0" cellPadding="2">
<tbody>
<tr class="CUI-TableGridLinesRow">
<td title="Provider Accounting Home Page" class="CUI-TableGridLinesRow" id=" 39" onmouseover="javascript:colorRow(this)" onmouseout="unColorRow(this)" onmousedown="javascript:colorRowClick(this)" onclick="javascript:nodeOnClick(this);" IgfSessionSecurity="<1" IgfFwdCred="false" IgfText="Provider Accounting Home Page" IgfUrl="../Bin/SmsTntRequest.asp?action=StartBusinessProcess&name=ProviderAccountingHomePage&form=ProviderAccountingHomePage&&GSM=duAuQFBuIBQHBxEpBxP-ALj98ABtQ9rL:XezOC76g7axKlXthZBxb5rrcVbgPa5wMe7QmxBQWL18_" IgfType="2">
<font face="Arial" size="2">
Text - Provider Accounting Home Page
答案 0 :(得分:0)
<td>
元素,标题为&#34;提供商会计主页&#34; ID为39
(带有前导空格),因此您应该可以选择这样的元素:
Set td = HTMLDoc.getElementById(" 39")
修改所以,显然您发布了确切的HTML结构,除了它嵌套在<iframe>
中的细微细节。这需要您进入iframe才能获取所需的元素。
Set iframe = HTMLDoc.getElementsByTagName("iframe").Item("tabWell0")
Set td = iframe.contentWindow.document.getElementById(" 39")