我想写一个javascript:
- 当页面加载时,获取 a 的内容
<div>
标签和
- 将该内容放置在弹出页面上。
对剧本有什么想法吗?
我知道如何导航到该元素,但不知道如何复制内容。
div 的内容将是这样的
<div id="validationDiv">
<div id="ctl00_Main_OTClaim1_valControls" class="errorpanel" style="color:Red;">
<ul><li>Approver Name - required field.</li><li>Week Commencing Date - required field.</li><li>Summary of Hours Worked must be completed.</li><li>At least one item must be claimed to proceed.</li></ul>
</div>
</div>
其中验证 div 包含我想要复制到新窗口的内容
cheers
window.onload = function() {
var el = document.getElementById("ctl00_Main_OTClaim1_valControls");
var html = "";
if (el) {
html = document.getElementById("ctl00_Main_OTClaim1_valControls").innerHTML;
var xopen = window.open("about:blank");
xopen.document.write(html);
}
}
--UPDATE
window.onload = function() {
var el = document.getElementById("ctl00_Main_OTClaim1_valControls"); //the element you want expanded
var html = "";
if (el) {
html = el.innerHTML;
var xopen = window.open("about:blank");
xopen.document.write(html);
}
}
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)