MJC*_*der 4 javascript jquery internet-explorer-7
以下脚本未在IE7中运行,但在IE 8 + 9和所有其他浏览器中运行良好.即使放入alert("something");不起作用 - 我有另一个脚本工作正常,并在IE 7完美运行.
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
Run Code Online (Sandbox Code Playgroud)
我错过了DOCTYPE吗?这是下面的脚本;
var formPageTitle = $("div.hsRadarform td h3").text();
$('.AspNet-DataList td a').each(function (index) {
var listElementText = $(this).text();
var shade = "faint";
if(formPageTitle.toLowerCase() == listElementText.toLowerCase()) {
shade = "dark";
}
//adding the numbered circles here using jQuery
$(this).css({
'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
'background-repeat': 'no-repeat',
'height': '25px',
'width': '25px',
});
});
Run Code Online (Sandbox Code Playgroud)
Man*_*eUK 14
使用尾随逗号,IE非常挑剔:
$(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
'background-repeat': 'no-repeat',
'height': '25px',
'width': '25px',
});
Run Code Online (Sandbox Code Playgroud)
应该
$(this).css({ 'background-image': 'url(/assets/img/radarstep' + (index + 1) + shade + '.png)',
'background-repeat': 'no-repeat',
'height': '25px',
'width': '25px' // comma removed
});
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
2790 次 |
| 最近记录: |