IE7

36 views
Skip to first unread message

Александр Павленко

unread,
May 11, 2013, 1:36:09 PM5/11/13
to prototype-s...@googlegroups.com
Почему не работает такой код IE7

<div id='div'></div>
<script src="javascript/ie7.js">
var cont=$('div');
var t=new Element('table',{'width':'200px'});Element.extend(t);
cont.insert(t);
var tr=new Element('tr');Element.extend(t);
var td=new Element('td').update('hello');Element.extend(t);
t.insert(tr);
tr.insert(td)
</script>

Jason Westbrook

unread,
May 12, 2013, 12:46:32 PM5/12/13
to prototype-s...@googlegroups.com

I'm sorry if this is not exactly what you asked but I'm going to try and point out a few problems and see if that answers your question.

Firstly you cannot declare a src attribute and put javascript in the same <script> tag

You do not need to re-extend the variable "t" after you have created a new Element - it is already extended.

You have your statements out of order which is why it is probably not working. You are adding "t" to $('div') immediately instead of building the entire contents of "t" then inserting into "cont"


Try this



<div id='div'></div>
<script src="javascript/ie7.js"></script>

<script>

var cont=$('div');
var t=new Element('table',{'width':'200px'});
var tr=new Element('tr');
var td=new Element('td').update('hello');
tr.insert(td)
t.insert(tr);
cont.insert(t);
</script>






Jason Westbrook | T: 313-799-3770 | jwest...@gmail.com


--
You received this message because you are subscribed to the Google Groups "Prototype & script.aculo.us" group.
To unsubscribe from this group and stop receiving emails from it, send an email to prototype-scripta...@googlegroups.com.
To post to this group, send email to prototype-s...@googlegroups.com.
Visit this group at http://groups.google.com/group/prototype-scriptaculous?hl=en.
For more options, visit https://groups.google.com/groups/opt_out.
 
 

Александр Павленко

unread,
May 12, 2013, 1:13:51 PM5/12/13
to prototype-s...@googlegroups.com
так в других браузерах работает...в том числе IE8...........IE7 не работает ...не пойму чему...
Jason те ошибки ,что Вы указали проблему не решают

Александр Павленко

unread,
May 12, 2013, 4:41:12 PM5/12/13
to prototype-s...@googlegroups.com
все нашел решение  ...таблица в ИЕ должна содержать tbody в обязательном порядке.
var cont=$('div');
var t=new Element('table',{'width':'200px'});
var tb=new Element('tbody')
var tr=new Element('tr');
var td=new Element('td').update('hello');
cont.insert(t);
t.insert(tb)
tb.insert(tr);
tr.insert(td);
Reply all
Reply to author
Forward
0 new messages