getelementsbyname

GetelementsByTagName seems to not work properly

ぃ、小莉子 提交于 2019-12-11 05:18:22
问题 this question sounds stupid but how come when I use the function GetElementsByTagname("frame") , it only returns 3 as a length and not 5 as I expected ? Here is the HTML of the webpage where I counted 5 times the apparition of the tagname "frame" but when I ask for the length in VBA I get 3... My observations : 1) You can see that 3 is the number of main frames (top_navigation, contentframe, dummyframe) 2) If I try to access to one of the mainframes via getelementbyname, it works but if I try

HTML5 Audio Player: How to select by HTML elements instead of div ID's?

泄露秘密 提交于 2019-12-10 11:58:38
问题 Making an html5 player, I'm moving away "from divs with id's" towards "simple html elements". Old Situation (works) <audio src="track1.mp3" id="audio"></audio> <controls> <play id="play" style="display:none">PLAY</button> <pause id="pause" style="display:none">PAUSE</button> <div id="progress"><div id="bar"></div></div> </controls> Javascript gets elements by divs with an id var myAudio = document.getElementById('audio'); var play = document.getElementById('play'); var pause = document

how to access checkboxes and their values with getElementsByName

回眸只為那壹抹淺笑 提交于 2019-12-07 01:40:50
问题 Suppose I have the following section of a form: <td> <p> <input type="checkbox" name="faddon" onchange="iaddon()" value="89.00" /><br /> <input type="checkbox" name="faddon" onchange="iaddon()" value="29.00" /><br /> <input type="checkbox" name="faddon" onchange="iaddon()" value="49.00" /><br /> <input type="checkbox" name="faddon" onchange="iaddon()" value="39.00" /> </p> </td> <td> <p> <input type="checkbox" name="faddon" onchange="iaddon()" value="69.00" /><br /> <input type="checkbox"

javascript, getelementbyname and focus

删除回忆录丶 提交于 2019-12-06 04:53:06
问题 I am trying to create function that will look at the username if it is not valid send an alert to the user, clear the username field, and put the username field back into focus. I am trying to do this all with the getElementsBynName() function. It is all working with the exception of getting the field back into focus. My code is below. Does anyone have any suggestions. function uchecker(uname) { var validUname = uname.search(/^\w+@sabc.com$/); if(validUname != 0) { alert("You have entered an

javascript, getelementbyname and focus

て烟熏妆下的殇ゞ 提交于 2019-12-04 09:54:20
I am trying to create function that will look at the username if it is not valid send an alert to the user, clear the username field, and put the username field back into focus. I am trying to do this all with the getElementsBynName() function. It is all working with the exception of getting the field back into focus. My code is below. Does anyone have any suggestions. function uchecker(uname) { var validUname = uname.search(/^\w+@sabc.com$/); if(validUname != 0) { alert("You have entered an invalid username. \n The username must be a valid @sju.edu email address value " + document

GetElementsByName with array like name

流过昼夜 提交于 2019-12-04 09:03:22
i often use this notation when i name my controls in order to get an array in POST or GET. <input name="color[1]" type="text" /> <input name="color[2]" type="text" /> <input name="color[3]" type="text" /> so in my scripts i can do <?php $data=$_GET["color"]; for each ($color as $key=>$value) { doSomething(); } ?> Often happens that i need to get those id back in javascript , but i cannot get them , so i often add an ID to each element in html like that <input name="color[3]" id="color_3" type="text" /> so that i can use document.getElementsById('color_3') Instead i would like to find way to

javascript loop only applying to every other element

核能气质少年 提交于 2019-12-04 04:17:02
问题 i have the following javascript below after i finish an ajax query all of my images have name="pic" <script type="text/javascript"> function done() { var e = document.getElementsByName("pic"); alert(e.length); for (var i = 0; i < e.length; i++) { cvi_instant.add(e[i], { shadow: 75, shade: 10 }); } } my goal is to apply an image border around using this library: http://www.netzgesta.de/instant/ the problem is that for some reason this works but it only seem to apply to every other picture

javascript loop only applying to every other element

爷,独闯天下 提交于 2019-12-01 21:01:45
i have the following javascript below after i finish an ajax query all of my images have name="pic" <script type="text/javascript"> function done() { var e = document.getElementsByName("pic"); alert(e.length); for (var i = 0; i < e.length; i++) { cvi_instant.add(e[i], { shadow: 75, shade: 10 }); } } my goal is to apply an image border around using this library: http://www.netzgesta.de/instant/ the problem is that for some reason this works but it only seem to apply to every other picture instead of every one. any clue why the code above would skip every other element?? EDIT: I added an alert

C# get element by name

北城余情 提交于 2019-11-29 14:50:14
Soo ive figured out how to get element by id, but i dont know how i can get element by name Here is my code: private void SendData() { webBrowser1.Document.GetElementById("textfield1").SetAttribute("value", textBox1.Text); webBrowser1.Document.GetElementById("textfield2").SetAttribute("value", textBox1.Text); } The problem is in my html code only textfield1 is a id but textfield2 is name soo i want to figure out how to get textfield2 Here is my html code: <html> <input type="text" id="textfield1" value="TEXT1"><br> <input type="text" name="textfield2" value="TEXT2"><br> <input type="submit"

On IE document.getElementsByName won't work

我怕爱的太早我们不能终老 提交于 2019-11-28 11:17:09
I use this code: <div name="1234"> <img src="pic.gif" height="70" width="100" onMouseOver="clear('1234')"> </div> And: function clear(element_name){ document.getElementsByName(element_name)[0].innerHTML=""; } It does work in Firefox and Opera, but doesn't work in IE 6.0 or IE 8.0, and probably not even in newer IE's. What to do? Well, the problem is this: IE understands document.getElementsByName(...)[0] as document.getElementById(...). So if you would define also an id for your element, the method document.getElementsByName(element_name)[0].innerHTML="" will surprisingly also work in IE! But

工具导航Map