2012-04-07 7 views
3

その後、私はすべてのブラウザ例prototype.jsの1.6新しい要素クラスとIE> = 9

new Element('div',{'class':'name'}); 

のために、と新しい要素を作成しようとしていますが、クラス「名前」を使用して新しい要素を作成します。あなたはそれがclassName属性の代わりにクラスを作成し、参照としてではなく、Internet Explorer 9の10で私はこの

<div className="name"></div> 

を持っています。 これを修正するにはどうすればよいですか?

答えて

3
//This generates 'className': 
var popoutControl = new Element('div', {'class':'mySuperCoolClassName'}); 

// Break the line up into two lines. 
// The following will generate a 'class' attribute instead: 
var popoutControl = new Element('div'); 
popoutControl.className = 'mySuperCoolClassName'; 
0

http://prototypejs.org/api/element/classNames要素から示唆されているように

var mydiv = new Element('div'); 
mydiv.addClassName('name'); 

new Element('div',{'class':'name'}); 

を交換してください。 ClassName( 'name'); は廃止され、Elementを使用する必要があります。 addClassName()。

0

ここに私の答えをご覧ください。

https://stackoverflow.com/a/20668126/1274995

基本的には、プロトタイプ1.6はIEのこれらのバージョンではバグがあります。 Prototypeを更新する必要があります。

Element._attributeTranslations.write in Prototype 1.7+

私はで働いていたことを推測する問題が

Object Element._attributeTranslations.write in Prototype 1.6.0.3

これはプロトタイプ1.7に一覧があるElement._attributeTranslations.writeに含まれる翻訳リストである(以上、私は考えます)古いバージョンのIE(これはおそらくIE9以前のものでした)。