<!DOCTYPE html>
<html>
<head>
<script type="text/javascript" src="./jquery.js"></script>
<style type="text/css">
.spades { color: blue; font-family: Arial, Verdana, Tahoma, sans-serif; font-size: 120%; font-weight:bold }
.hearts { color: red; font-family: Arial, Verdana, Tahoma, sans-serif; font-size: 120%; font-weight:bold }
.diams { color: #FF6600; font-family: Arial, Verdana, Tahoma, sans-serif; font-size: 120%; font-weight:bold }
.clubs { color: #009D00; font-family: Arial, Verdana, Tahoma, sans-serif; font-size: 120%}
</style>
</head>
<body onload="bid_done('2C','TESTSTRING')">
<table id="bidsdone" border="1">
<caption><b>Bids done:</b></caption>
<tr>
</tr>
</table>
TEST3
<div>
<p id="clu"><span class="clubs">♣</span></p>
<p id="dia"><span class="diams">♦</span></p>
<p id="hea"><span class="hearts">♥</span></p>
<p id="spa"><span class="spades">♠</span></p>
</div>
</body>
<script type="text/javascript">
function add_bid_done() {
var table=document.getElementById("bidsdone");
var row=table.insertRow(-1);
var cell1=row.insertCell(0);
}
function bid_done(x,bc) {
add_bid_done();
var bid_abbr = x;
var bidsdoneRows=1;
var bidsdoneCell=0;
var rows=document.getElementById("bidsdone").rows;
var rowCells=rows[bidsdoneRows].cells;
x=x.replace(/C/g,document.getElementById("clu").innerHTML);
x=x.replace(/D/g,document.getElementById("dia").innerHTML);
x=x.replace(/H/g,document.getElementById("hea").innerHTML);
x=x.replace(/S/g,document.getElementById("spa").innerHTML);
x=x.replace(/N/g,"NT");
rowCells[bidsdoneCell].innerHTML=x;
rowCells[bidsdoneCell].title=bc;
rowCells[bidsdoneCell].abbr=bid_abbr;
rowCells[bidsdoneCell].setAttribute('onclick', 'alert(title)');
}
</script>
</html>
以上代码在 Firefox 10.0.4 中有效,但在 IE7 中无效。(这只是显示我遇到的问题的代码的一部分。)我在 IE7 中有两个问题:
它显示“2<♠PANT class=clubs>♣♠PANT>”是 Green Clubs 字符。
onclick 似乎不起作用。
谢谢,科恩