JRS: In article <11*********************@i39g2000cwa.googlegroups. com>,
dated Thu, 6 Apr 2006 12:24:35 remote, seen in
news:comp.lang.javascript, U. Cortez - Research
<go************@yahoo.com> posted :
I'm putting together some javascript code whose output needs to be
formatted into two columns. I was trying to put it in an html table
until someone alerted me that IE doesn't accept JS within tables. So
I'm looking for workarounds or alternatives. I've Googled and have
found plenty of similar questions, but no concrete solutions.
Someone recommended just putting the table tags (table, tr, td) in
document.write() functions, but this still yields the "Operation
Aborted" error in IE.
Any clues?
Without seeing a minimal demonstration of your actual code, or knowing
which version of IE you are testing with, it's hard to know why it does
not succeed. The following works for me as an HTML page :-
<script>
var Yr=1600, X=4, St
B = "<\/th>\n<\/tr>\n<tr>\n<th>", C = "<\/th>\n<th>"
St = "<table summary=\"T1\" border=1>\n" +
"<caption>TABLE I<\/caption>\n<tr>\n<th>" +
"6543210".split("").join(C) + B +
"BCDEFGA".split("").join(C) + B +
" ".split(" ").join(" <\/th>\n<th>") + " <\/th>\n"
while (Yr<=8500) {
St += "<td>" + Yr ; Yr += 100
if (Yr%400==0) { St += "<br>" + Yr ; Yr += 100 }
St += "<\/td>\n"
X++ ; if (X==7) { X=0 ; St += "<\/tr>\n<tr>\n" } }
St += "<td>&c.<\/td>\n<td>" +
" ".split(" ").join(" <\/td>\n<td>") +
" <\/td>\n<\/tr>\n<\/table>"
document.writeln(St)
</script>
However, it's certainly possible to amend an existing Table after
loading.
Read the newsgroup FAQ.
--
© John Stockton, Surrey, UK. ?@merlyn.demon.co.uk Turnpike v4.00 IE 4 ©
<URL:http://www.jibbering.com/faq/> JL/RC: FAQ of news:comp.lang.javascript
<URL:http://www.merlyn.demon.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demon.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links.