在javascript中对否将一个对象附值给另一个对象 其实,我要的是window.open() 产生一个新窗体所并把父窗体中一个panel传过新窗体。并显示出来。是如何实现。 解决方案 » 免费领取超大流量手机卡,每月29元包185G流量+100分钟通话, 中国电信官方发货 当前窗口里面的元素用 element.cloneNode(true); 其他窗口的元素嘛...... 创建一个一样的元素:newPanel2=document.createElement(oldPanel1.outerHTML) 插入到当前窗口:obj.insertBefore(newPanel2)或者obj.appendChildnewPanel2) obj为窗口中的一个容器元素,如td或span或div。 html没有panel这个东东吧var oldPanel1 = document.getElementById("Panel1");var newPanel2 = window.document.createElement("div");newPanel2.outerHTML = oldPanel1.outerHTML;window.document.body.appendChild(newPanel2); var chartImage = document.getElementById("Panel1"); // create a new window var newWindow = window.open("", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no"); chartImage.cloneNode(true); var newPanel2=document.createElement(chartImage.outerHTML); newWindow.document.body.appendChild(newPanel2);这样不成啊。报错。不支持此接口。点解? <script type="text/javascript">function PrintChart(){ // reference the chart image var chartImage = document.getElementById("Panel1"); chartImage.cloneNode(true); // create a new window var newWindow = window.open("", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no"); var newPanel2=newWindow.document.createElement("Panel"); newPanel2.outerHTML =chartImage.outerHTML; newWindow.document.body.appendChild(newPanel2);} </script><body> <form id="form1" runat="server"> <div> <asp:Panel ID="Panel1" runat="server" Height="66px" Width="273px"> <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox> <asp:Button ID="Button1" runat="server" Text="Button" /></asp:Panel> <br /> <input type="button" value="Print" onclick="PrintChart()" /> </div> <div id="div1"></div> </form></body>这样没报错。但Panel1中有的控件在新窗体中没有出现。 panel在html中就是divvar newPanel2=newWindow.document.createElement("Panel");--〉var newPanel2=newWindow.document.createElement("DIV"); 改成这样:function PrintChart() { // reference the chart image var chartImage = document.getElementById("Panel1"); // create a new window var newWindow = window.open("a.aspx", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no"); var newPanel2=newWindow.document.createElement("div"); newWindow.document.body.appendChild(newPanel2); newPanel2.innerHTML = chartImage.outerHTML; } 一道CSS题求助 求一条javascript的正则表达式 关于传递的参数不完整的问题 /// C#里如何跳出一段一句不执行接下来的代码? 请帮忙看看这是为什么啊! 谁知道这个功能怎么实现啊? 如何读取web.config配置文件内容 关于服务器图片保存方案的纠结 给datagrid做右键,该如何实现啊,各位大侠帮帮忙!! ASP.net编程环境 页面传值! 网站间传值的问题
其他窗口的元素嘛......
创建一个一样的元素:newPanel2=document.createElement(oldPanel1.outerHTML)
插入到当前窗口:obj.insertBefore(newPanel2)或者obj.appendChildnewPanel2)
obj为窗口中的一个容器元素,如td或span或div。
var newPanel2 = window.document.createElement("div");newPanel2.outerHTML = oldPanel1.outerHTML;
window.document.body.appendChild(newPanel2);
// create a new window
var newWindow = window.open("", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no"); chartImage.cloneNode(true);
var newPanel2=document.createElement(chartImage.outerHTML);
newWindow.document.body.appendChild(newPanel2);这样不成啊。报错。
不支持此接口。点解?
function PrintChart()
{
// reference the chart image
var chartImage = document.getElementById("Panel1");
chartImage.cloneNode(true);
// create a new window
var newWindow = window.open("", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no");
var newPanel2=newWindow.document.createElement("Panel");
newPanel2.outerHTML =chartImage.outerHTML;
newWindow.document.body.appendChild(newPanel2);
}
</script>
<body>
<form id="form1" runat="server">
<div>
<asp:Panel ID="Panel1" runat="server" Height="66px" Width="273px">
<asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
<asp:Button ID="Button1" runat="server" Text="Button" /></asp:Panel>
<br />
<input type="button" value="Print" onclick="PrintChart()" />
</div>
<div id="div1"></div>
</form>
</body>这样没报错。但Panel1中有的控件在新窗体中没有出现。
var newPanel2=newWindow.document.createElement("Panel");
--〉
var newPanel2=newWindow.document.createElement("DIV");
function PrintChart()
{
// reference the chart image
var chartImage = document.getElementById("Panel1");
// create a new window
var newWindow = window.open("a.aspx", "Chart", "height=350, width=450, location=no, toolbar=no, titlebar=no, resizable=no, status=no, menubar=no");
var newPanel2=newWindow.document.createElement("div");
newWindow.document.body.appendChild(newPanel2);
newPanel2.innerHTML = chartImage.outerHTML;
}