此代码在IE中不起作用,为什么不呢?
$('body').append('<div id="iedialog"><h2 class="dialog-header">Alert!</h2><div class="dialog-container"><center>It looks like you are using Internet Explorer! Please switch to another browser to use all our Designer features. We recommend Firefox (<a href="www.firefox.com">www.firefox.com</a>) and Google Chrome (<a href="www.google.com/chrome">www.google.com/chrome</a>) for an overall better internet experience.<br /><br /><input type="button" value="OK" id="okiedialog"></center>');
然而,如果我在控制台中复制并粘贴这些确切的代码,它就可以工作。
答案 0 :(得分:1)
我会指出你的代码有几个问题。附加的标记无效。可以看出它何时被分解。
1)您的代码未正确关闭
<div id="iedialog">
<h2 class="dialog-header">Alert!</h2>
<div class="dialog-container">
<center>
It looks like you are using Internet Explorer! Please switch to another browser to use all our Designer features. We recommend Firefox (<a href="www.firefox.com">www.firefox.com</a>) and Google Chrome
(
<a href="www.google.com/chrome">www.google.com/chrome</a>
)
for an overall better internet experience.
<br />
<br />
<input type="button" value="OK" id="okiedialog">
</center>
您的input
代码未关闭,您的div
代表dialog-container
和代码iedialog
未关闭。
1)您的标记使用已弃用的标记center
。摆脱它,然后再试一次。