IHTMLDOMNode 接口 獲取同級元素


dom節點樹

圖中可見節點HTML文檔中的每個成分都是一個節點:

  • 整個文檔是一個文檔節點
  • 每個HTML標簽是一個元素節點
  • 包含在HTML元素中的文本是文本節點
  • 每個HTML屬性是一個屬性節點
  • 注釋屬於注釋節點

備注:通過DOM,可以訪問HTML文檔中的每個節點。

二、節點引用

節點的絕對引用:

  • document.documentElement返回文檔的根節點
  • document.activeElement返回當前文檔中被擊活的標簽節點
  • event.fromElement返回鼠標移出的源節點
  • event.toElement返回鼠標移入的源節點
  • event.srcElement返回激活事件的源節點

節點的相對引用:(設當前對節點為node)

  • node.parentNode node.parentElement 返回父節點,document.parentNode()返回null
  • node.childNodes[1] 符合標准,返回子節點集合(包含文本節點及標簽節點),文本和屬性節點的childNodes永遠是null.先獲取長度node.childNodes.length,然后可以通過循環或者索引找到需要的節點.
    //對與文本節點的處理:
    eg:
    var myTextNodes = document.getElementById("test").childNodes;
    var count = myTextNodes.length;
    for(var i = 0; i < count; i++) {
      if(myTextNodes[i].nodeType=="3" && myTextNodes[i].nodeName!="#text"){//排除IE空白文本的節點
      alert(myTextNodes[i]);
    }
    }
    
  • node.children 不符合標准,不推薦使用,它只返回html節點,甚至不返回文本節點
  • node.firstChild返回第一個子節點,firstChild=childNodes[0]
  • node.lastChild返回最后一個子節點,lastChide=childNodes[childNodes.length-1]
  • node.nextSibling()返回同屬下一個節點
  • node.previousSibling()返回同屬上一個節點

三、節點操作

  • 節點定位
    getElementById(elementId)
    //尋找一個有着給定id屬性值的元素,返回一個元素節點 ,document.getElementById(IDvalue)
    
    getElementsByTagName(tagName)
    //用於尋找有着給定標簽名的所有元素,document.getElementsByTagName(tagName)
    
    getElementsByName(elementName)
    //在HTML中checkbox和radio都是通過相同的name屬性值,來標識一個組內的元素。如果我們現在要獲取被選中的元素,首先獲取改組元素,然后循環判斷是節點的checked屬性值是否為true即可
  • 創建節點:
    document.createElement(element)
    //參數為要新添的節點標簽名,egnewnode=document.createElement("div"); 
    
    document.createTextNode(string)
    //創建一個包含着給定文本的新文本節點,eg:document.createTextNode("hello");
    

    eg:

    var a =document.createElement("span");
    var b =document.createTextNode("cssrain");
    a.appendChild(b);
    
  • 添加節點:
    //添加子節點:
    node.appendChild(newChild) //newChild為生新增的節點.eg: document.body.appendChildNode(o) document.forms[0].appendChildNode(o)
    
    //插入節點
    node.insertBefore(newNode,targetNode)
    node.insertAfter(newNode,targetNode);
  • 修改節點:
    //刪除節點
    node.remove()[2] //當某個節點被remove方法刪除時,這個節點所包含的所有子節點將同時被刪除。
    node.removeChild(node) //eg:document.body.removeChild(node)
    node.removeNode()//IE支持,但FF不支持,推薦用removeChild代替實現
    
    //替換節點
    node.replaceChild(newChild,oldChild) //oldChild節點必須是node元素的一個子節點。
    node.replaceNode() node.swapNode()//只有IE支持replaceNode與swapNode方法,其他瀏覽器則不支持。
    
  • 復制節點:
    //返回復制節點引用
    node.cloneNode(bool)//bool為布爾值,true / false 是否克隆該節點所有子節點 ,eg:node.cloneNode(true)
  • 獲取節點信息:
    .nodeName//只讀,返回節點名稱,相當於tagName.
    .nodeValue//可讀可寫,但對元素節點不能寫。返回一個字符串,指示這個節點的值。元素節點返回null,屬性節點返回屬性值,文本節點返回文本。一般只用於設置文本節點的值。
    .nodeType//只讀,返回節點類型:1,元素節點;2,屬性節點;3,文本節點。 
    
    node.contains() //是否包含某節點,返回boolean值,IE支持,FF不支持contains(),但支持W3C標准compareDocumentPosition() .
    node.hasChildNodes()//是否有子節點,返回boolean值
  • 屬性節點:
    setAttribute(key,value)//element.setAttribute(attributeName,attributeValue),setAttribute()方法只能用在屬性節點上。
    getAttribute(key)//返回一個給定元素的一個給定屬性節點的值

備注:

[1]childNodes兼容性問題說明:

用IE的調試工具會發現IE中把空格解析成“#text”,即IE會把2個標簽之間只要有回車或空格的地方解析成空白文本節點,就多了個節點nodeName="#text"。而FF中卻不會。

  • 測試代碼:

    //節點之間留有空格和回車
    <div id="test1">
    <div>first</div>
    <div>second</div>
    <div>third</div>
    </div>
    
    //除注釋外,節點間無空格回車
    <div id="test2"><div>first</div><div>second</div><div>third</div></div>
    
    var val1=document.getElementById("test1").childNodes.length;
    var val2=document.getElementById("test2").childNodes.length;
    alert("val1="+val1+":"+"val2="+val2)
  • 測試結果:

    IE中是val1=7:val2=3
    FF中是val1=3:val2=3

  • 兼容性解決辦法:

    在for循環里不妨加上:
    if(childNode.nodeName=="#text") continue;
    或者nodeType == 1。

[2]add(),remove()兼容性問題:

注意的是add,remove方法僅用於area,controlRange,options等集合對象.

<select>
<option value="1">option1</option>
<option value="2">option2</option>
</select>
<script type="text/javascript">
function fnAdd(){//兼容IE,FF,Opera,Chrome
var oOption=document.createElement("option");
document.getElementById("#oList").options.add(oOption);
oOption.text="option3";
oOption.value="3";
}
function fnRemoveChild(){//兼容IE,FF,Opera,Chrome
document.getElementById("#oList")).removeChild(document.getElementById("#oList").lastChild);
}
function fnRemove(){
//兼容IE,FF,Opera,Chrome
document.getElementById("#oList").remove(0);
}
</script>

擴展知識:

innerHTML、outerHTML、innerText、outerText

  • 定義:

    • innerHTML設置或獲取標簽內的HTML,eg:獲取node.innerHTML 設置node.innerHTML="hello"
    • outerHTML設置或獲取標簽及標簽內的HTML
    • innerText設置或獲取標簽內的文本
    • outerText設置(包括標簽)或獲取(不包括標簽)對象的文本
  • 不同之處:

    innerHTML與outerHTML在設置對象的內容時包含的HTML會被解析,而innerText與outerText則不會。

    在設置時,innerHTML與innerText僅設置標簽內的文本,而outerHTML與outerText設置包括標簽在內的文本。

  • 注意:

    W3C 只支持innerHTML. 其他都是微軟的規定.(outerHTML,outerText,innerText只有微軟的IE 好使, 其他瀏覽器不好用(firefox, mozilla等),必須用其他方法實現)

posted @ 2011-03-05 11:27 益力多 閱讀(16) | 評論(0) | 編輯

2011年3月4日

WebBrowser
控件文件:system32/shdocvw.oca  shdocvw.dll 
注冊:regsvr32 shdocvw.dll 
WebBrowser.OleObject.Document 為活動的文檔返回自動化對象,引用 Microsoft HTML Object Library 可查看詳細屬性和方法 

■■方法 ============================== 
▲GoBack    相當於IE的“后退”按鈕,使你在當前歷史列表中后退一項 
▲GoForward 相當於IE的“前進”按鈕,使你在當前歷史列表中前進一項 
▲GoHome    相當於IE的“主頁”按鈕,連接用戶默認的主頁 
▲GoSearch  相當於IE的“搜索”按鈕,連接用戶默認的搜索頁面 
▲Navigate  連接到指定的 URL,並顯示網頁 
▲Navigate2 與 Navigate 作用同? 
▲Refresh   刷新當前頁面 
▲Refresh2  同上,只是可以指定刷新級別,所指定的刷新級別的值來自RefreshConstants枚舉表, 
   該表定義在ExDisp.h中,可以指定的不同值如下: 
   REFRESH_NORMAL 執行簡單的刷新,不將HTTP pragma: no-cache頭發送給服務器 
   REFRESH_IFEXPIRED 只有在網頁過期后才進行簡單的刷新 
   REFRESH_CONTINUE 僅作內部使用。在MSDN里寫着DO NOT USE! 請勿使用 
   REFRESH_COMPLETELY 將包含pragma: no-cache頭的請求發送到服務器 
▲Stop      相當於IE的“停止”按鈕,停止當前頁面及其內容的載入 
■■屬性=================================== 
▲Document 為活動的文檔返回自動化對象。如果HTML當前正被顯示在 Web1 中,則 Document 提供 
         對DHTML Object Model的訪問途徑。下面有詳細介紹 
▲TopLevelContainer 返回一個Boolean值,表明 IE 是否是 Web1 控件頂層容器,是就返回 true 
▲Type    返回已被 Web1 控件加載的對象的類型。例如: 
        如果加載.doc文件,就會返回 Microsoft Word Document 
▲LocationName 返回一個字符串,該字符串包含着 Web1 當前顯示的資源的名稱, 
        如果資源是網頁就是網頁的標題; 
        如果是文件或文件夾,就是文件或文件夾的名稱 
▲LocationURL 返回 Web1 當前正在顯示的資源的 URL 
▲Busy 返回一個Boolean值,說明 Web1 當前是否正在加載 URL,如果返回 true 
        就可以使用 stop 方法來撤銷正在執行的訪問操作 
▲Object  設置返回一個顯現網頁的 SHDocVwCtl.WebBrowser_V1 對象。參見下文。 
▲MenuBar 
▲StatusBar 
▲ToolBar 
▲Visible 

■■事件=================================== 
▲BeforeNavigate2    導航發生前觸發(打開網頁前),刷新時不觸發 
▲CommandStateChange 當命令的激活狀態改變時觸發。它表明何時激活或關閉Back和Forward菜單項或按鈕 
▲DocumentComplete   當整個文檔完成是觸發,刷新頁面不觸發 
▲DownloadBegin      當某項下載操作已經開始后觸發,刷新也可觸發此事件 
▲DownloadComplete   當某項下載操作已經完成后觸發,刷新也可觸發此事件 
▲NavigateComplete2  導航完成后觸發,刷新時不觸發 
▲NewWindow2         彈出新窗口以前觸發 
   可在此事件中設置 ppDisp 參數新網頁顯示對象,同時不會出現 SHDocVwCtl.WebBrowser_V1 的 NewWindow 事件 
▲OnFullScreen       當 FullScreen 屬性改變時觸發。該事件采用 VARIENT_BOOL 的一個輸入參數來指示 IE 是全 
   屏顯示方式(VARIENT_TRUE)還是普通顯示方式(VARIENT_FALSE) 
▲OnMenuBar          改變 MenuBar 屬性時觸發,標示參數是 VARIENT_BOOL 類型的。 
   VARIANT_TRUE 可見,VARIANT_ FALSE 隱藏 
▲OnQuit             無論是用戶關閉瀏覽器還是開發者調用Quit方法,當IE退出時就會觸發 
▲OnStatusBar        改變 StatusBar 屬性時觸發,標示狀態欄是否可見。 
▲OnToolBar          改變 ToolBar 屬性時觸發,標示工具欄是否可見。 
▲OnVisible          改變 Visible 屬性時觸發 
▲StatusTextChange   控件的狀態信息改變時觸發。 
▲TitleChange        網頁標題改變時觸發。參數 Text 是新標題,Web1.LocationName 屬性是舊標題
 
■■SHDocVwCtl.WebBrowser_V1 對象================== 
  在窗體聲明部分加入:Private WithEvents Web_V1 As SHDocVwCtl.WebBrowser_V1 
  在  Form_Load 加入:Set Web_V1 = Web1.Object 
  這樣,Web_V1 就會有如下事件: 
▲NewWindow  彈出新窗口以前觸發 
  如果在 Web1_NewWindow2 設置了 ppDisp 為新顯示對象,就不會出現此事件 
  ★例子1,用自己開發的程序的新窗口顯示彈出網頁: 
    Dim nForm As New FormMain 'FormMain 為你的放有 Web1 控件的窗體 
    Processed = True '阻止控件調用 IE 彈出窗口 
    nForm.Show 
    nForm.Web1.Navigate URL 
  ★例子2,在同一窗口顯示網頁: 
    Processed = True '阻止控件調用 IE 彈出窗口 
    Web1.Navigate URL 
 
■■Web1.Document 對象(HTMLDocument 對象)======================= 
▲All(1)集合,已加載到 Web1 中的 html 文檔包含的所有標簽對象:HTMLAreaElement 
  集合對象索引起點為0,總個數為 All.length 
  可以用索引訪問其中對象,如:All(1) 
  也可以用 Html 頭元素名稱訪問對象,如:All("body") 
  All(0) 一般是自身的 outerHTML,可以這樣返回文檔代碼(查看源文件): 
    Text1.Text = Web1.Document.All(0).outerhtml 
  但上一條語句並不可靠,有的網頁開頭的代碼不是<html>,而是其他,例如:<!--STATUS OK--> 
  All()集合有 HTMLAreaElement 對象的大多數屬性,有的元素還有特有的屬性。 
  注意 某元素的 sourceIndex 屬性就是該對象在 Document.All() 集合中的編號 
▲body          主體元素對象:IHTMLElement 
▲activeElement 活動元素:IHTMLElement 
▲anchors       錨集合:IHTMLElementCollection 
▲appendChild   方法:附加子對象(newChild As IHTMLDOMNode) As IHTMLDOMNode 
▲applets       程序集合Java:IHTMLElementCollection 
▲attachEvent   方法:隸屬事件(event As String, pdisp As object) As Boolean 
▲attributes    屬性對象:object 
▲bgColor       背景色:Variant 
▲childNodes    子節點:object 
▲clear         方法:清除 
▲cloneNode     方法:復制節點(fDeep As Boolean) As IHTMLDOMNode 
▲close         方法:關閉 
▲compatMode 
▲cookie                 緩存 
▲createAttribute        方法:創建屬性(bstrattrName As String) As IHTMLDOMAttribute 
▲createComment          方法:創建注釋(bstrdata As String) As IHTMLDOMNode 
▲createDocumentFragment 方法:創建文檔片段() As IHTMLDocument2 
▲createDocumentFromUrl  方法:從URL創建文檔(bstrUrl As String, bstrOptions As String) As IHTMLDocument2 
▲createElement          方法:創建元素(eTag As String) As IHTMLElement 
▲CreateEventObject      方法:創建事件對象([pvarEventObject]) As IHTMLEventObj 
▲createRenderStyle      方法:(v As String) As IHTMLRenderStyle 
▲createStyleSheet       方法:創建方式表([bstrHref As String], [lIndex As Long = -1]) As IHTMLStyleSheet 
▲createTextNode         方法:創建文本節點(text As String) As IHTMLDOMNode 
▲defaultCharset         默認字符集? 
▲detachEvent            方法:分離事件(event As String, pdisp As object) 
▲dir 
▲doctype             文檔類型:IHTMLDOMNode 
▲documentElement      文檔元素:IHTMLElement 
▲domain 
▲elementFromPoint     方法:點所屬組(x As Long, y As Long) As IHTMLElement 
▲embeds               :IHTMLElementCollection 
▲execCommand          方法:實行命令(cmdID As String, [showUI As Boolean = False], [value]) As Boolean 
▲execCommandShowHelp  方法:幫助命令(cmdID As String) As Boolean 
▲fgColor              前景色:Variant 
▲fileCreatedDate      文件創建日期 
▲file Modified Date   文件修改日期 
▲fileSize             文件大小 
▲fileUpdatedDate      文件更新日期 
▲FireEvent            方法:首事件(bstrEventName As String, [pvarEventObject]) As Boolean 
▲firstChild           首子對象:IHTMLDOMNode 
▲focus                方法: 
▲forms                窗體:IHTMLElementCollection 
▲frames               框架結構:FramesCollection 
▲getElementById       方法:獲取指定的 ID 元素(v As String) As IHTMLElement 
▲getElementsByName    方法:獲取指定的   Name  元素集合(v As String) As IHTMLElementCollection 
▲getElementsByTagName 方法:獲取指定的 TagName 元素集合(v As String) As IHTMLElementCollection 
▲hasChildNodes        方法: 
▲hasFocus             方法:() As Boolean 
▲images               圖像集合:IHTMLElementCollection 
▲implementation       執行:IHTMLDOMImplementation 
▲insertBefore         方法:插入前面(newChild As IHTMLDOMNode, [refChild]) As IHTMLDOMNode 
▲lastChild 
▲lastModified         上一修改 
▲linkColor            鏈接色 
▲alinkColor           A 鏈接色: 
▲vlinkColor           V 鏈接色: 
▲links                連接集合:IHTMLElementCollection 
▲location             位置:HTMLLocation 
▲media                媒體 
▲mimeType 
▲nameProp 
▲namespaces           名稱空間:object 
▲nextSibling          下一相同對象 
▲nodeName 
▲nodeType 
▲nodeValue 
▲open              方法:打開([url As String = "text/html"], [name], [features], [replace]) As object 
▲ownerDocument     所有者文檔:object 
▲parentNode        父節點:IHTMLDOMNode 
▲parentWindow      父窗口:IHTMLWindow2 
▲plugins           插件集合?:IHTMLElementCollection 
▲previousSibling   前一兄弟:IHTMLDOMNode 
▲protocol          協議 
▲queryCommandEnabled   方法:查詢命令能否執行(cmdID As String) As Boolean 
▲queryCommandIndeterm  方法:查詢命令?  (cmdID As String) As Boolean 
▲queryCommandState     方法:查詢命令狀態(cmdID As String) As Boolean 
▲queryCommandSupported 方法:查詢命令支持(cmdID As String) As String 
▲queryCommandText      方法:查詢命令文本(cmdID As String) As Boolean 
▲queryCommandValue     方法:查詢命令值  (cmdID As String) 
▲readyState 
▲recalc         方法:([fForce As Boolean = False]) 
▲referrer 
▲releaseCapture 方法: 
▲removeChild    方法: 
▲removeNode     方法: 
▲replaceChild   方法: 
▲replaceNode    方法:替換節點(replacement As IHTMLDOMNode) As IHTMLDOMNode 
▲scripts              script集合:IHTMLElementCollection 
▲security             安全:String 
▲selection            已選擇的對象集合:IHTMLSelectionObject 
▲styleSheets          方式表單:HTMLStyleSheetsCollection 
▲swapNode   方法:交換節點(otherNode As IHTMLDOMNode) As IHTMLDOMNode 
▲title 
▲toString   方法: 
▲url 
▲URLUnencoded 
▲write      方法:(ParamArray psarray() As Variant) 
▲writeln    方法:(ParamArray psarray() As Variant) 
▲onstop 既是屬性,又是事件 
▲共有屬性和事件 
■■共有屬性和事件:既是屬性,又是事件。面帶 on 的======================= 
▲onactivate         onActivate         激活 
▲onafterupdate      onAfterUpdate      更新后 
▲onbeforeactivate   onBeforeActivate   激活前 
▲onbeforecopy       onBeforeCopy       復制前 
▲onbeforecut        onBeforeCut        剪切前 
▲onbeforedeactivate onBeforeDeactivate 無效前 
▲onbeforeeditfocus  onBeforeEditFocus  獲得編輯焦點前 
▲onbeforepaste      onBeforePaste      粘貼前 
▲onbeforeupdate     onBeforeUpdate     更新前 
▲onblur             onBlur             模糊 
▲oncellchange       onCellChange       單元改變 
▲onclick            onClick            單擊 
▲oncontextmenu      onContextMenu      上下文菜單 
▲oncontrolselect    onControlSelect    控件選定 
▲oncopy             onCopy             復制 
▲oncut              onCut              剪切 
▲ondataavailable    onDataAvailable    有用數據 
▲ondatasetchanged   onDataSetChanged   數據設置改變 
▲ondatasetcomplete  onDataSetComplete  數據設置完成 
▲ondblclick         onDblClick         雙擊 
▲ondeactivate       onDeactivate       變為非活動 
▲ondrag             onDrag             拖 
▲ondragend          onDragEnd          拖結束 
▲ondragenter        onDragEnter        拖進 
▲ondragleave        onDragLeave        拖離 
▲ondragover         onDragOver         拖過 
▲ondragstart        onDragStart        拖開始 
▲ondrop             onDrop 
▲onerrorupdate      onErrorUpdate      更新錯誤 
▲onfilterchange     onFilterChange     過濾器改變 
▲onfocus            onFocus       
▲onfocusin          onFocusIn          焦點進入 
▲onfocusout         onFocusOut         焦點離開 
▲onhelp             onHelp 
▲onkeydown          onKeyDown 
▲onkeypress         onKeyPress 
▲onkeyup            onKeyUp 
▲onlayoutcomplete   onLayoutComplete   版面完成 
▲onlosecapture      onLoseCapture      失去捕獲 
▲onmousedown        onMouseDown 
▲onmouseenter       onMouseEnter 
▲onmouseleave       onMouseLeave 
▲onmousemove        onMouseMove 
▲onmouseout         onMouseOut 
▲onmouseover        onMouseOver 
▲onmouseup          onMouseUp 
▲onmousewheel       onMouseWheel       鼠標滾輪 
▲onmove             onMove 
▲onmoveend          onMoveEnd 
▲onmovestart        onMoveStart 
▲onpage             onPage 
▲onpaste            onPaste            粘貼 
▲onpropertychange   onPropertyChange   性質改變 
▲onreadystatechange onSeadyStateChange 准備狀態改變 
▲onresize           onResize 
▲onresizeend        onResizeEnd 
▲onresizestart      onResizeStart 
▲onrowenter         onRowEnter         行進入 
▲onrowexit          onRowExit 
▲onrowsdelete       onRowsDelete 
▲onrowsinserted     onRowsInserted 
▲onscroll           onScroll 
▲onselectstart      onSelectStart 
 
■■HTMLDivElement  對象:div 元素特有的屬性======================= 
▲align         排列:String 
▲dataFld       數據流體:String 
▲dataFormatAs  數據格式:String 
▲dataSrc       數據Src:String 
▲noWrap 
■■HTMLAreaElement  對象:區域元素 大多數元素共有的屬性======================= 
一個 HTMLAreaElement 可以包含多個 HTMLAreaElement 對象,用 all() 集合訪問 
▲sourceIndex   對象在 Document.All() 集合中的編號 
▲accessKey  String:訪問鍵 
▲addBehavior  方法:添加行為(bstrUrl As String, [pvarFactory]) As Long 
▲addFilter    方法:添加過濾器(pUnk As Unknown) 
▲all          【參 HTMLAreaElement】 
▲alt 
▲appendChild  【參 HTMLAreaElement】 
▲applyElement 方法:申請元素(apply As IHTMLElement, where As String) As IHTMLElement 
▲attachEvent  方法:隸屬事件(event As String, pdisp As object) As Boolean 
▲attributes   【參 HTMLAreaElement】 
▲behaviorUrns 行為缸對象:object 
▲blur         方法:模糊 
▲canHaveChildren 是否能擁有子對象 
▲canHaveHTML     是否能擁有HTML 
▲childNodes      子節點:object 
▲children        是否子對象 
▲className       類名 
▲clearAttributes 方法:清除屬性 
▲click           方法:單擊 
▲clientHeight    內部高度? 
▲clientLeft 
▲clientTop 
▲clientWidth 
▲cloneNode          方法:克隆節點(fDeep As Boolean) As IHTMLDOMNode 
▲componentFromPoint 方法:點所屬組(x As Long, y As Long) As String 
▲contains           方法:包含contains(pChild As IHTMLElement) As Boolean 
▲contentEditable 
▲coords 
▲createControlRange 方法:創建控制山脈(行列)() As object 
▲currentStyle       當前樣式:IHTMLCurrentStyle 
▲detachEvent        方法:分離事件(event As String, pdisp As object) 
▲dir 
▲disabled       不可用 
▲document       文檔對象:object 
▲doScroll  方法([component]) 
▲dragDrop  方法:拖放 
▲filters   過濾器: IHTMLFiltersCollection 
▲FireEvent 方法FireEvent(bstrEventName As String, [pvarEventObject]) As Boolean 
▲firstChild  首子對象:IHTMLDOMNode 
▲focus            方法 
▲getAdjacentText  方法:獲取臨近文本(where As String) As String 
▲getAttribute     方法:獲取屬性(strAttributeName As String, [lFlags As Long]) 
▲getAttributeNode 方法:獲取屬性節點(bstrName As String) As IHTMLDOMAttribute 
▲getBoundingClientRect 方法:獲取內部范圍矩形() As IHTMLRect 
▲getClientRects        方法:獲取委托矩形() As IHTMLRectCollection 
▲getElementsByTagName  【參 HTMLAreaElement】 
▲getExpression         方法:獲取表達(propname As String) 
▲hasChildNodes         【參 HTMLAreaElement】 
▲hash        無用信息 
▲hideFocus 
▲host        主人 
▲hostname    主人名稱 
▲href      默認屬性 
▲id          標示字符串 
▲innerHTML   元素內的 html 代碼 
▲innerText   內部的純文本,可以顯示到網頁上的文字 
▲insertAdjacentElement 方法:插入臨近元素(where As String, insertedElement As IHTMLElement) As IHTMLElement 
▲insertAdjacentHTML    方法:(where As String, html As String) 
▲insertAdjacentText    方法:(where As String, text As String) 
▲insertBefore          方法:(newChild As IHTMLDOMNode, [refChild]) As IHTMLDOMNode 
▲isContentEditable 
▲isDisabled 
▲isMultiLine 
▲isTextEdit 
▲lang 
▲language 
▲lastChild 
▲mergeAttributes  方法:合並屬性(mergeThis As IHTMLElement, [pvarFlags]) 
▲nextSibling      下一同級對象 
▲nodeName 
▲nodeType 
▲nodeValue 
▲noHref 
▲normalize        方法:規格化 
▲offsetHeight  偏移(縮進)高度 
▲offsetLeft 
▲offsetParent 
▲offsetTop 
▲offsetWidth 
▲outerHTML          包含元素本身及內部的 html 代碼 
▲outerText 
▲ownerDocument 
▲parentElement 
▲parentNode 
▲parentTextEdit 
▲pathname 
▲port 
▲previousSibling 
▲protocol 
▲readyState 
▲recordNumber 
▲releaseCapture       方法:釋放捕獲 
▲removeAttribute      方法:移除屬性 
▲removeAttributeNode  方法 
▲removeBehavior       方法:移除行為 
▲removeChild          方法 
▲removeExpression     方法 
▲removeFilter         方法 
▲removeNode           方法 
▲replaceAdjacentText  方法:替換臨近文本 
▲replaceChild         方法 
▲replaceNode          方法 
▲runtimeStyle   運行方式:IHTMLStyle 
▲scopeName      范圍名稱 
▲scrollHeight 
▲scrollIntoView   方法 
▲scrollLeft 
▲scrollTop 
▲scrollWidth 
▲search 
▲setActive        方法 
▲setAttribute     方法 
▲setAttributeNode 方法 
▲setCapture       方法 
▲setExpression    方法 
▲shape 
▲style 
▲swapNode         方法:交換節點 
▲tabIndex 
▲tagName          標簽名 
▲tagUrn           標簽缸 
▲target           目標 
▲title 
▲toString 
■■Web1 應用例子 
▲在網頁加裁完畢后,運行其中某層的鏈接,當然事先必須知道該層鏈接的TagName: 
   WebBrowser1.OleObject.Document.getElementsByname("TagName").click。


免責聲明!

本站轉載的文章為個人學習借鑒使用,本站對版權不負任何法律責任。如果侵犯了您的隱私權益,請聯系本站郵箱yoyou2525@163.com刪除。



 
粵ICP備18138465號   © 2018-2025 CODEPRJ.COM