基于JavaScript的中国象棋实现与IE6兼容性问题

作者:代码拾荒时间:2026-10-30 13:53:05浏览:236

本文介绍一个基于JavaScript实现的中国象棋小游戏,重点探讨其在IE6.0环境下的兼容性问题。该程序采用非XHTML标准,可能导致在IE7.0等后续版本中无法正常运行。游戏设定为蓝方先行,并提供了代码运行、复制及保存功能。

IE6兼容性与非标准实现

该程序最初针对IE6.0浏览器进行开发。


由于未遵循XHTML标准,该代码可能在IE 7.0及更高版本中无法正常运行,这引发了对浏览器兼容性的关注。


游戏机制设定为蓝方玩家拥有先手权。


游戏界面与交互功能

<style> * { font:24px arial, "宋体"; font-weight:bold; color:white; cursor:default; } table { table-layout:fixed; border-collapse:collapse; position:absolute; left:50px; top:50px; } td { width:80px; height:80px; border:1px solid silver; color:black; text-align:center; line-height:80px; } img.i1 { width:78px; height:78px; } img.i2 { width:49px; height:49px; } img.i3 { width:25px; height:49px; } .chessman_red { background:url(/attachments/2007/3/29/20070329_2187cc5e9def581951f2v22EfdUSXQ7J.jpg); width:50px; height:50px; line-height:50px; text-align:center; } .chessman_blue { background:url(/attachments/2007/3/29/20070329_5caa80c54f776b93bd582BwraVRWXf43.jpg); width:50px; height:50px; line-height:50px; text-align:center; } </style>  <input type="button" value="重开" onclick="window.location.reload();" style="position:absolute; left:800px;"> <input type="button" value="悔棋" onclick="undo();" style="position:absolute; left:900px;"> <div id="d_his_red" style="font-size:12px; color:#333;position:absolute; left:800px; top:450px; width:120px; height:300px; overflow:auto;"></div> <div id="d_his_blue" style="font-size:12px; color:#333;position:absolute; left:800px; top:100px; width:120px; height:300px; overflow:auto;"></div>

注意:引入外部JavaScript文件后,必须刷新页面才能确保脚本正确执行。

作者最新文章