js模拟form打开新窗口
2018-10-13 11:43
295 查看
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head runat="server"> <title></title> <script type="text/javascript"> function openUrl(iid) { var temp_form = document.getElementById("item_form"); if (temp_form == null) { temp_form = document.createElement("form"); temp_form.action = "/xxx.aspx"; temp_form.target = "_blank"; temp_form.method = "get"; temp_form.setAttribute("id", "item_form"); var temp_input = document.createElement("input"); temp_input.setAttribute("type", "hidden"); temp_input.setAttribute("id", "item_id"); temp_input.name = "id"; temp_input.value = iid; temp_form.appendChild(temp_input); document.body.appendChild(temp_form); } else { document.getElementById("item_id").value = iid; } temp_form.submit(); } </script> </head> <body> <form id="form1" runat="server"> <div> <a href="javascript:openUrl(1)">a1</a> <br /> <a href="javascript:openUrl(2)">a2</a> <br /> <a href="javascript:openUrl(3)">a3</a> </div> </form> </body> </html>
相关文章推荐
- JS 模式对话框 form提交 重新打开窗口问题
- Safari WebApp 模拟 原声APP禁止打开新窗口JS代码
- JS~模拟表单在新窗口打开,避免广告拦截
- js 打开窗口window.open
- js打开模式化窗口
- js定时打开新窗口并隐藏
- 用JS打开新窗口,防止被浏览器阻止的解决方法
- js使用post 方式打开新窗口
- 转:js怎么样控制打开网页窗口的大小,HTML如何关闭窗口大全(经典+有用+常用)
- IE和其他浏览器用JS新窗口打开的问题
- js_ajax模拟form表单提交_多文件上传_支持单个删除
- JS打开新窗口的2种方式
- Form提交打开固定大小窗口的解决办法(VBscritp)
- 全屏代码 js 设置的 窗口全屏打开代码
- JS打开新窗口的2种方式
- IFRAME弹出式窗口回发数据到父页面[调用父页JS方法并模拟调用按钮的回发事件]
- js打开新窗口的方法
- js菜单伸缩,点击打开弹出浏览窗口
- js页面跳转 和 js打开新窗口 方法
- JS 点击元素发ajax请求 打开一个新窗口