这段代码不能在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>');
如果我复制粘贴这段代码到控制台上,它就能工作了
我将指出您的代码存在的几个问题。附加的标记无效。当它被分解时可以看到。
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
标签未关闭,您的dialog-container
类别和id为iedialog
的div
未关闭。
1)您的标记使用已弃用的标记center
。把它删掉再试一次