getelementsbytagname

getElementsByTagName is null or undefined, only in IE - and only in one particular spot in the function [duplicate]

Deadly 提交于 2019-12-23 17:03:13
问题 This question already has answers here : Closed 7 years ago . Possible Duplicate: getElementById.contentDocument error in IE listed below is my javascript code. What it does is searches the whole document for all iframes, then searches the iframes for all images. The parent and child frames are all my code on the same domain. The code works fine in chrome, FF and safari, but not IE. Here is the error I'm getting. Microsoft JScript runtime error: Unable to get value of the property

Why DomDocument getElementsByTagName give back an half NodeList?

我与影子孤独终老i 提交于 2019-12-23 09:34:23
问题 I generate some non-standard-tag HTML with DomDocument and the result is this: /* Input HTML <div id="toobar_top"> <widget id="flag_holder"></widget> <widget id="horizontal_menu"></widget> </div> <div id="header"> <widget name="header"></widget> </div> */ What I want to do is to "translate" each widget in something useful... they are simple placeholders with params. The function extract from the class is: private function widgeter($doc) { //Give it an DomDocument HTML containing <widget>

Getting tag as well as the values? XML [duplicate]

ε祈祈猫儿з 提交于 2019-12-23 03:47:15
问题 This question already has answers here : How to read XML using XPath in Java (8 answers) Closed 3 years ago . I have the following XML being passed as String. <?xml version="1.0"?> <tagMain> <tag1> <a> <a>1</a> <b>2</b> <c>3</c> <d>4</d> </a> <b>5</b> <c>6</c> <d>7</d> <e>8</e> <f>9</f> </tag1> <tag2> <r> <r1>10</r1> <r2>11</r2> <r3>12</r3> <r4>13</r4> </r> <b>14</b> <c>15</c> <d>16</d> <e>17</e> <f>18</f> </tag2> <tag3> <a> <a>1m</a> <b>2m</b> <c>3m</c> <d>4m</d> </a> <b>5m</b> <c>6m</c> <d

Can I select multiple tags using getElementsByTagName?

不打扰是莪最后的温柔 提交于 2019-12-18 11:42:02
问题 I'm using a javascript snippet in order for visitors to my site to increase the font size on all paragraphs using the following javascript: function increaseFontSize() { var paragraphs = document.getElementsByTagName('p'); for(i=0;i<paragraphs.length;i++) { if(paragraphs[i].style.fontSize) { var s = parseInt(paragraphs[i].style.fontSize.replace("px","")); } else { var s = 14; } if(s != max) { s += 1; } paragraphs[i].style.fontSize = s+"px" } } How can I also include "li" to this code so that

轮播02--上下滚动

99封情书 提交于 2019-12-18 02:00:17
<! DOCTYPE HTML > < html > < head > < meta http-equiv = "Content-Type" content = "text/html; charset=utf-8" > < title > 轮播图-上下滚动 </ title > < style > body,ul,ol { margin : 0 ; padding : 0 ;} li { list-style : none ;} img { border : none ; vertical-align : top ; } #box { width : 470px ; height : 150px ; position : relative ; margin : 30px auto ; overflow : hidden ;} ul { width : 470px ; position : absolute ; left : 0 ; top : 0 ; z-index : 1 ;} ul li { width : 470px ; height : 270px } ol { z-index : 2 ; width : 120px ; position : absolute ; right : 10px ; bottom : 10px ;} ol li { width : 20px ;

Javascript getElement by href?

試著忘記壹切 提交于 2019-12-17 17:45:08
问题 I've got the script below var els = document.getElementsByTagName("a"); for(var i = 0, l = els.length; i < l; i++) { var el = els[i]; el.innerHTML = el.innerHTML.replace(/link1/gi, 'dead link'); } However this searches through the page and takes about 20 seconds to do it as there are LOTS of links. However I only need to target the a 's that have a specific href , for eg. "http://domain.com/" So ideally I'd like to be able to do this in a similar fashion to jQuery, but without using a

how to get the meta name keywords -vba

偶尔善良 提交于 2019-12-13 04:53:25
问题 I am trying to get the meta name keywords from a webpage meta name="keywords" content="Mitch Albom,For One More Day,Little, Brown Book Group,0751537535,Fiction / General,General & Literary Fiction,Modern & contemporary fiction (post c 1945),USA I need to get the contents from it need help. Option Explicit Sub GetData() Dim ie As New InternetExplorer Dim str As String Dim wk As Worksheet Dim webpage As New HTMLDocument Dim item As HTMLHtmlElement Set wk = Sheet1 str = wk.Range("Link").value ie

“Null” is null or not an object error in IE javascript

混江龙づ霸主 提交于 2019-12-12 18:47:37
问题 The following code executes fine in Firefox and Chrome, but gives an error: 'null' is null or not an object when executed in Internet Explorer. if (xmlhttp.responseXML != null) { var xmlDoc = xmlhttp.responseXML.documentElement ; var ResultNodes = xmlDoc.getElementsByTagName ("Result") ; <---- error here if (ResultNodes != null) { (I would have thought the line after the one indicated would be more likely to return the error but the debugger says the run-time error is at the line indicated)

Insert created element at start of html tag using PHP DOM

百般思念 提交于 2019-12-12 14:04:12
问题 I'm trying to insert an HTML <base> tag immediately after the opening <head> tag of a page using dom. I've tried using appendChild which just inserts it before the </head> which is no good. Code im using: $head = $dom->getElementsByTagName('head')->item(0); $base = $dom->createElement('base'); $base->setAttribute('href', $url); $head->parentNode->insertBefore($base, $head); This inserts the <base> tag before the <head> , which is still no good! Any ideas? Beer for the correct answer! 回答1:

Why do getElementsByTagName() always returns an array?

爷,独闯天下 提交于 2019-12-12 12:35:45
问题 Why is it that if I have only one h1 element in the document, I still have to use the index to access it? Like the following doesn't work. document.getElementsByTagName('h1').innerHTML = "SHUSHAN"; but if I do document.getElementsByTagName('h1')[0].innerHTML = "SHUSHAN"; It does work. Even though I only have one h1 , why do I have to specify? 回答1: Short answer: This is so that you can have some sanity. If you don't know whether you will get a single element or a collection of elements, you