The IE problem getElementsByName

2011-05-27  来源:本站原创  分类:Web  人气:83 

More than one page, the li element of the same name, wants to document.getElementsByName () to get array of elements. Normal in firefox, but can not work under ie, the returned length is 0.

IE, only the original form elements getElementsByName useful (or part of the elements useful). Find all elements by getElementsByTagName, getAttribute method in the screening by the elements.

function getElementsByName(tag,eltname){

var elts=document.getElementsByTagName(tag);

var count=0;

var elements=[];

for(var i=0;i<elts.length;i++){

if(elts[i].getAttribute("name")==eltname){

elements[count++]=elts[i];

}

}

return elements;

}
相关文章
  • The IE problem getElementsByName 2011-05-27

    More than one page, the li element of the same name, wants to document.getElementsByName () to get array of elements. Normal in firefox, but can not work under ie, the returned length is 0. IE, only the original form elements getElementsByName useful

  • getElementsByName incompatibility problem solving 2010-08-20

    getElementsByName method is not compatible with IE, now use document.all () to replace, but the need to replace the need to name id. <table border="1" width="100%"> <tr><td>ssssssssssssssssssssss</td><td>s

  • document.all problem 2008-08-28

    ie support for document.all and firefox does not support the So, when in the development of general-purpose web site, it is necessary to avoid this problem, the solution has three, that is, to switch to one of the following three tag instead of docum

  • document.getElementsByName under the IE bug resolved 2010-06-17

    That package prompted a ajax side input side label, in JS scripts to document.getElementsByName, upon testing, found in firefox, opera, safari, chrome to test no problem, but that is the IE, is that we Chinese are a more than half of people use IE, i

  • JS after ajax request return of the problem can not be implemented 2009-03-01

    1: Send ajax request, in the onComplete, if back when the html contains a javascript, then these javascrip and will not be realized, it does not mean not to implement. This problem has troubled me for a long time, behind the hair and then put this kn

  • Msxml2.XMLHTTP version problem 2009-03-01

    Projects with an import feature prototype.js of Ajax functionality to update the prompt, the code is very simple, do not have the framework of the background on a jsp to output Text, future use of timers and to update the page Ajax.request encountere

  • About rails install mysql driver error problem 2009-03-02

    My local wamp server using one of the key package, only used mysql functions, today in the use of rake db: migrate when First reported a month can not be implemented, the next inquiry and found no mysql installed a gem, to install gem install mysql i

  • Ext common problem of summing up 2009-03-05

    scripts / ext / resources / css / ext-all.css / / EXT generic CSS, contains all the style (must) scripts / ext / resources / css / icon.css / / custom menu item or other storage page icon scripts / utils / HiTRUST-CMS.css / / old version of the payme

  • ROR Problem Record 1 2009-03-08

    Recorded so forgotten. Rails projects could not link to MySql database. Prompted libmysql.dll file not found, the files are copied to the system32 directory window, problem solving.

  • Repair using javascript browser problem 2009-03-12

    Original: http://www.noupe.com/css/using-javascript-to-fix-12-common-browser-headaches.html We advocate at all times as much as possible the use of CSS, so that we more likely to succeed. Now the browser support for CSS has been very good, certainly

  • Chinese javascript AJAX Problem summary 2009-03-15

    Ajax garbled today met the problem, at-line for a long time to find information on a variety of test methods, and finally found this article or tell me the correct way, and would like to thank. Original Address: http://www.blogjava.net/hulizhong/arch

  • Xls and csv export Ruby's utf-8 problem 2009-03-16

    Database data for utf-8 format, including Chinese and Latin and so on Xls export file format and csv format will be garbled when the situation 0, the premise of At database.yml using utf8 encoding connect to database: encoding: utf8 1, xls Use spread

  • Use javascript to calculate the accuracy of floating-point problem 2009-03-19

    AJAX applications become more widespread today, occasionally the use of javascript for some floating point calculation. Try a bit today and found a very interesting question. In fact, this problem with java is the same as the problem is the accuracy

  • Rails & SQLite3 & Debian Linux under the migration problem 2009-03-20

    Rails using SQLite as the default database. However, under Debian Linux, always walk migration, the total back to the name have questions, 『Could not find table 'xxx'』. Was identified as the problem of the Rails adapter. / usr/lib/ruby/gems/1.8/gems/

  • File upload problem encountered strange, lighttpd forward should not correct, return a http 301, Robbin like mentioned 2009-03-21

    Scenarios: Upload pictures (post / photos), Go to the rails of the create action . Webrick normal use. Observation lighttpd log, forward to the rails of dispatch.fcgi, back are the basic 302 (temporary redirect), which do not have any problem post. H

  • Spring + Hibernate, CRD no problem, update invalid?? 2009-03-29

    Yes my spring2.5.6 + hibernte3.3, did not use spring and hibernateTemplate the HibernateDaoSupport, only its AnnotationSessionFactoryBean, Tim censored search do not have any problem, as long as one update on the invalid, the console is not error. I

  • About js control automatic telescopic iframe problem 2009-04-02

    http://blog.csdn.net/teachy521/archive/2008/12/02/3429102.aspx Through Google search iframe highly adaptive, resulting in more than 5W, search iframe highly adaptive, resulting in more than 2W. I turned in front of dozens of articles, many reprinted

  • Js regarding automatic telescopic control iframe problem 2009-04-04

    http://blog.csdn.net/teachy521/archive/2008/12/02/3429102.aspx Through Google search iframe highly adaptive, resulting in more than 5W, search iframe highly adaptive, resulting in more than 2W. I turned in front of dozens of articles, many reprinted

  • jmeter distributed testing small problem 2009-04-06

    Recently, the project required to carry out stress tests, but only four computer-on-hand, one of a server, do not say this to the deployment of programs and databases. Another three are separately developing a XP machine, vista and liux. One of the w

  • Hibernate many-to-many delete problem 2009-04-09

    Hibernate many-to-many, many examples, but one look carefully, most of them are saved, delete the small talk, but there are still many problems, so has the need for a simple test, here we come to a simple set up many-to-many relationship Teacher and