getelementsbyclassname

getElementsByClassName and AJAX

跟風遠走 提交于 2019-12-11 00:22:35
问题 Am I missing something with getElementsByClassName() and querySelectorAll()? In Firefox 9 and Chrome 17 and probably all browsers, it seems that both of these functions return an empty array when executed on an AJAX response. See the following link for an example. http://jsfiddle.net/r8ryr/5/ I can call document.getElementsByClassName('findme') or anyElement.getElementsByClassName('findme') for any element within the DOM of the current page, but for some reason it doesn't seem to work on the

vba, getElementsByClassName, HTMLSource's double quotation marks are gone

本秂侑毒 提交于 2019-12-10 16:34:43
问题 I scrape some websites with vba for fun and I use VBA as tool. I use XMLHTTP and HTMLDocument (cause it's more faster than internetExplorer.Application). Public Sub XMLhtmlDocumentHTMLSourceScraper() Dim XMLHTTPReq As Object Dim htmlDoc As HTMLDocument Dim postURL As String postURL = "http://foodffs.tumblr.com/archive/2015/11" Set XMLHTTPReq = New MSXML2.XMLHTTP With XMLHTTPReq .Open "GET", postURL, False .Send End With Set htmlDoc = New HTMLDocument With htmlDoc .body.innerHTML = XMLHTTPReq

Disable text box using class name in Javascript

无人久伴 提交于 2019-12-10 15:35:27
问题 I have HTML Name 1:<input type="text" class="one" id="mytext"> <button onclick="disfunction()"></button> Javascript function disfunction(){ document.getElementsByClassName("one").disabled = true; } But the text box is still enabled. How can I disable text box using the classname in JAVASCRIPT . Using id I can do this. Also using jquery. But I need a solution using Javascript and classname . 回答1: getElementsByClassName return a list of elements, you need to loop througth it to disable each

getElementsByClassName IE resolution issue

余生长醉 提交于 2019-12-10 14:27:53
问题 I am having issues figuring out how to resolve the getElementsByClassName issue in IE. How would I best implement the robert nyman (can't post the link to it since my rep is only 1) resolution into my code? Or would a jquery resolution be better? my code is function showDesc(name) { var e = document.getElementById(name); //Get a list of elements that have a class name of service selected var list = document.getElementsByClassName("description show"); //Loop through those items for (var i = 0;

What is an alternative to using getElementByClass for hiding multiple elements?

ぃ、小莉子 提交于 2019-12-08 14:40:16
问题 I have a page that has a few links that I would like to be able to toggle with two buttons. It works with one link, using getElementById, but I need to toggle a few groups of them. I started with this, but it failed to work. I heard that getElementByClass worked with everything but IE, but I'm using Opera 11.5 and it still wont work. I've done a little searching, but I'm somewhat new to javascript and don't understand most of the explanations. Can someone help me with a simple alternative, or

Changing background image using Javascript

房东的猫 提交于 2019-12-07 19:25:08
问题 I have been trying to create a slideshow on one of the web pages I've been creating. I have created a div with a unique class name that is targeted in order to change the background image using JavaScript. So far, I have been able to do the following: Capture the div where I want to change the background image by using the querySelector Attempted to change the background image of said div using JavaScript I have been debugging this function using DevTools, yet I cannot figure out why the

Changing background image using Javascript

落爺英雄遲暮 提交于 2019-12-06 15:48:27
I have been trying to create a slideshow on one of the web pages I've been creating. I have created a div with a unique class name that is targeted in order to change the background image using JavaScript. So far, I have been able to do the following: Capture the div where I want to change the background image by using the querySelector Attempted to change the background image of said div using JavaScript I have been debugging this function using DevTools, yet I cannot figure out why the image won't change. Any idea what is happening here? I have included snippets of the code below. Thank you.

Get Element By Classname Script Not Working

限于喜欢 提交于 2019-12-05 22:35:44
I know, it's not supported by IE, but I found a cool script online that someone was generous enough to provide for free, but I can't figure out why it's not working. I've been staring at this for hours, please point me in the right direction! My code: <script language="javascript" type="text/javascript" src="getbyclass.js"></script> <script type="text/javascript" language="javascript"> function editToggle(toggle){ if (toggle == "off"){ getElementsByClassName("editp").style.display ="none"; document.getElementById('editToggle').innerHTML="<a href=\"#\" onclick=\"editToggle(\"off\"); return

Object 'unavailable' in Firefox console

99封情书 提交于 2019-12-04 18:56:38
问题 I have a few divs with class='class_name' , and also have declared var A = document.getElementsByClassName('class_name'); console.log(A[0]); The Chrome console shows: <div class="class_name"> div 1 </div> The Firefox console shows: <unavailable> What's the issue or what otherwise is the possible cause? 回答1: Two possible workarounds: 1) Use the "Web-Console". The "Web-Console" (instead of the "Browser-Console") shows the expected output. 2) Disable "e10s" multiprocessor support: - about:config

How to add image to button via Javascript?

心已入冬 提交于 2019-12-04 14:43:10
问题 I am trying to add image to buttons I have using Javascript but I can't seem to get it working. I have sucessfully added image using HTML5, however, for my needs I need to add the image via javascript. Below is what I have written to add images via HTML. <button class="button" id="Ok"><img src="images/ok.png"></button> Below is what I have tried to add image via Javascript but it doesn't seem to work. var buttons = document.getElementsByClassName("button"); for (var b = 0; b < buttons.length;