JS操作Iframe获取到Iframe中的内容+ListView+DataPager分页
来源:互联网 发布:linux grub引导修复 编辑:程序博客网 时间:2024/05/22 23:59
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %><!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"> window.onload = function () { var txt = document.getElementById("txtShowIframe"); txt.onmousedown = function () { document.getElementById("div_showIfrmae").style.display = "block"; } txt.onmouseover = function () { document.getElementById("div_showIfrmae").style.display = "none"; } //按钮点击事件 document.getElementById("btnShowValue").onclick = function () { alert(document.getElementById("txtShowIframe").value); } f(); } //此方法用来获取iframe中src嵌入页面的内容 function f() { var doc; //判断浏览器 if (document.all) {//IE doc = document.frames["MyIFrame"].document; } else {//Firefox doc = document.getElementById("MyIFrame").contentDocument; } document.getElementById("txtShowIframe").value = "<%=stuAddress %>";//将iframe中拿到的值放到文本框中(值在后台接受) } </script></head><body> <form id="form1" runat="server"> <div> <input type="text" id="txtShowIframe" style="text-align:right;" /> <input type="button" id="btnShowValue" value="显示从iframe中点击到的值" /> <div id="div_showIfrmae" style="display:none; width:880px; height:445px;"> <iframe src="Default2.aspx" id = "MyIFrame" style=" color: #990099; width: 470px; height: 180px; border:1px solid green; margin:10px 123px;" name = "MyIFrame" frameborder="0"></iframe> </div> </div> </form></body></html>
Default.aspx后台代码
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;public partial class _Default : System.Web.UI.Page{ public string stuAddress = ""; protected void Page_Load(object sender, EventArgs e) { if (!IsPostBack) { if (Request.QueryString["stuAddress"] != null) { stuAddress = Request.QueryString["stuAddress"].ToString(); } } } }
//Default2.aspx前台代码
<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default2.aspx.cs" Inherits="Default2" %><!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> <style type="text/css"> .div_show{ border:1px solid red;} </style></head><body> <form id="form1" runat="server"> <div id="div_show"> <table> <tr> <td>学生邮箱</td> <td>学生地址</td> </tr> <asp:ListView ID="lsvShowStudentInfo" runat="server"> <LayoutTemplate> <tr id="itemPlaceholder" runat="server"></tr> </LayoutTemplate> <ItemTemplate> <tr> <td><%#Eval("StuEmail") %></td> <td onclick="parent.location.href='Default.aspx?stuAddress=<%#Eval("StuAddress") %>'" id="stuAddress" style=" cursor:pointer;"><%#Eval("StuAddress") %></td> </tr> </ItemTemplate> </asp:ListView> </table> <asp:DataPager runat="server" ID="dpg" PageSize="6" PagedControlID="lsvShowStudentInfo"> <Fields> <asp:NextPreviousPagerField ShowFirstPageButton="true" ShowNextPageButton="false" ShowLastPageButton="false" /> <asp:NumericPagerField ButtonCount="3" /> <asp:NextPreviousPagerField ShowFirstPageButton="false" ShowLastPageButton="true" ShowPreviousPageButton="false" /> </Fields> </asp:DataPager> </div> </form></body></html>
//Default2.aspx后台代码
using System;using System.Collections.Generic;using System.Linq;using System.Web;using System.Web.UI;using System.Web.UI.WebControls;using System.Configuration;using System.Data.SqlClient;using System.Data;public partial class Default2 : System.Web.UI.Page{ string connStr = ConfigurationManager.ConnectionStrings["Connection String"].ConnectionString; //获取webconfig里面的连接串 protected void Page_Load(object sender, EventArgs e) { SqlConnection conn = new SqlConnection(connStr); conn.Open(); string sql = "select * from student"; SqlDataAdapter adapter = new SqlDataAdapter(sql,conn); DataSet ds = new DataSet(); adapter.Fill(ds); lsvShowStudentInfo.DataSource = ds; conn.Close(); } protected void Page_PreRender(object sender, EventArgs e) { lsvShowStudentInfo.DataBind(); }}
- JS操作Iframe获取到Iframe中的内容+ListView+DataPager分页
- js操作Iframe(获取Iframe中的节点内容)
- JS操作iframe内容
- JS 获取页面中iframe中的内容
- 获取iframe中的内容
- js获取iframe的内容
- jq获取iframe中的内容
- js获取iframe中的内容 兼容火狐&&ie6
- 用JS操作FRAME中的IFRAME及其内容
- 通过JS操作iframe中的内容,遇到的问题
- js操作iframe中的dom
- jquery操作iframe中的js
- js获取iframe内的内容
- 利用webBrowser获取页面iframe中的内容
- 利用webBrowser获取页面iframe中的内容
- 获取iframe中内容
- js 控制iframe内容
- jquery操作iframe内容
- 更好的理解索引(此文只是告诉你,怎样去测试这类问题的方法)
- 技术人员成长
- Hive Partitioned & Index
- 【vim】ctags
- 【vim】Tagslist
- JS操作Iframe获取到Iframe中的内容+ListView+DataPager分页
- 【vim】AutoComplete
- 我的第一篇专业博客
- secureCRT从联通网登录到电信网机器时,速度很慢---解决方法:IP加速器软件
- C++基于TCP和UDP的socket通信
- php利用参数,分时处理大量数据
- 有关符号链接的学习(4.16)
- ARM Linux启动过程分析
- C#设计模式(23种设计模式)