【发布时间】:2014-07-16 00:19:48
【问题描述】:
如何将此document.write 代码的第一部分转换为弹出链接?请注意第一部分说"<a href=\"\/popups\/fed_budget.asp\"><img src=\"http:\/images\/video_graphic.jpg\ 等。如何将该按钮链接 (video_graphic.jpg) 更改为弹出窗口,而不是将我带到不同的页面?这是我目前拥有的:
document.write("<td width=\"251px\"><a href=\"\/popups\/fed_budget.asp\"><img src=\"http:\/images\/video_graphic.jpg\" alt=\"Video Graphic\" \/><\/a><\/td>");
document.write("<td style=\"padding-top:30px; padding-left:10px; padding-right:10px\">");
document.write("<b class=\"blue_text\">Recent News<\/b><br \/><br \/>");
document.write("<strong><a href=\"\/news\/newshub\/articles\/federal_budget_2014.asp\">Your Federal Budget Update<\/a> <\/strong> <b class=\"blue_text\">New<\/b><br \/>");
document.write("Read our run-down on the super side of this year's Budget.<br \/><br \/><br \/>");
document.write("<strong><a href=\"\/news\/newshub\/articles\/EOFY_Tips_tricks.asp\">EOFY tips and tricks<\/a><\/strong> <b class=\"blue_text\">New<\/b><br \/>");
document.write("Six strategies to help you get your super in shape.<br \/><br \/>");
document.write("<\/td>");
document.write("<\/tr>");
document.write("<\/table>");
【问题讨论】:
-
从不使用document.write开始,如果在文档最初加载后调用它会覆盖文档,完全不推荐。请改用 appendChild、innerHTML 等 DOM 方法。
标签: javascript frontend document.write