有谁知道为什么下面的脚本在IE9中不起作用?它适用于其他较新的浏览器。 而是显示弹出窗口(“class =”more“>),它会在您每次点击一个产品时删除它。
这是头部的代码:
<script language="JavaScript" type="text/javascript">
function cancelBubble(e) {
var evt = e ? e:window.event;
if (evt.stopPropagation) evt.stopPropagation();
if (evt.cancelBubble!=null) evt.cancelBubble = true;
}
function showHide(shID) {
if (document.getElementById(shID)) {
if (document.getElementById(shID+'-show').style.display != 'none') {
document.getElementById(shID+'-show').style.display = 'none';
document.getElementById(shID).style.display = 'block';
}
else {
document.getElementById(shID+'-show').style.display = 'inline';
document.getElementById(shID).style.display = 'none';
}
}
}
</script>
这是正文中代码的一部分:
<div class="main" style="position:relative;">
<form name="form1" id="form1">
<input type="hidden" name="productid" />
<input type="hidden" name="command" />
</form>
<h1>Webshop</h1>
<div style="margin: 1.5em -5px -20px -5px;">
<a href="#" id="example-show" onclick="showHide('example');return false;">
<div class="shopproduct" align="center">
<div style="height:175px; vertical-align:bottom; display:table-cell;"><img style="max-height:175px; max-width: 175px;" src="images/example.png" /></div>
<div style="font-size:1em; line-height:1.8em"><b>
Example name 1
</b><br />
<div style="font-size:0.8em; line-height:1.2em; height:2.4em;">
Short description example 1
...</div>
</div>
<div style="line-height:2em"><strong>€
9,50
</strong></div>
<div id="example" class="more" onclick="showHide('example');return false;">
<div onclick="cancelBubble(event);" style="position: absolute; background:#FFF;
top:50%;
left:50%;
width:400px; /* adjust as per your needs */
height:400px; /* adjust as per your needs */
margin-left:-200px; /* negative half of width above */
margin-top:-200px; /* negative half of height above */
z-index: 9002;
-moz-box-shadow: 0 0 8px rgba(0,0,0,0.5);
-webkit-box-shadow: 0 0 8px rgba(0,0,0,0.5);
box-shadow: 0 0 8px rgba(0,0,0,0.5);">
Short description example 1
<a href="#" id="example-hide" class="hideLink" onclick="showHide('example');return false;">Hide this content</a> </div>
</div>
</div>
</a>
<div style="position: absolute; top: 20px; right: 20px; width: 250px; line-height:2em;" align="right"><a href="shoppingcart.php">Artikelen in winkelwagen -
0
</a></div>
</div>
</div>
EDIT 12-11-2014:发布了PHP / MYSQL的HTML内容