仿博客项目整理笔记
来源:互联网 发布:pdf修改软件下载 编辑:程序博客网 时间:2024/05/17 07:44
js
动态创建div并绑定事件
var div = document.createElement("div");//创建div存放页数
div.className = "tooltip";
div.innerHTML =i;
div.name = "t"+i+"";
div.style.position = "absolute";
div.style.borderstyle = "solid";
div.style.border = "red";
div.style.left = ""+la+"px";
div.style.width = 100;
div.onclick = function xxx() {//将div与事件绑定动态
for (var i = 1; i <= x; i++) {//将table全部隐藏
var q1 = document.getElementById("t" + i + "");
q1.style.display = "none";
}
oooo = this.name//得到具体哪个按钮激发的事件
var q = document.getElementById(oooo);
q.style.display = "block";
};
var son_td = document.createElement("TD");
son_td.appendChild(div);//将div存放至表格TD中
son_tr.appendChild(son_td);
<link type="text/css" rel="Stylesheet" href="css/xwz.css"/>//连接至css
<script type="text/javascript" src="xjs.js"></script>//连接至js
web后台
Table qqq = new Table();//动态创建table
TableRow Row = new TableRow();//新建行
Row.CssClass = "tbiaoge";//为新建行提供classname方便css调整位置
TableRow Row1 = new TableRow();//新建列
Row1.CssClass = "tbiaoge1";
TableCell Cell1 = new TableCell();
string xxxxx = reader.GetString(reader.GetOrdinal("tfl"));//得到数据库中字段为tfl的值
Cell1.Text = xxxxx;
Row1.Cells.Add(Cell1);//没次创建两行,第二行为回复信息只需一列。将每列添加到行中
qqq.Rows.Add(Row);
qqq.Rows.Add(Row1);//将每行添加进table中
xplgl.Controls.Add(qqq);//将动态创建的表格添加到网页指定的空间
Button xb = new Button();
xb.Text = "删除";
xb.CommandName = id.ToString();
xb.BorderStyle = BorderStyle.None;
xb.ForeColor = System.Drawing.Color.Red;//为动态添加的按钮字体颜色赋值
xb.Click += new EventHandler(xsc);//动态为按钮添加事件
public void xsc(object sender, EventArgs e)
{
using (SqlConnection conn = new SqlConnection(connStr))
{conn.Open();
using (SqlCommand cmd = conn.CreateCommand())
{
Button b1 = (Button)sender;//得到具体是哪个按钮触法的时间通过按钮的属性判断连接的时间视哪个
int x = Convert.ToInt32(b1.CommandName);
cmd.CommandText = "delete from xfl where id="+x+"";
cmd.ExecuteNonQuery();
Response.Redirect("xpl.aspx");//跳转页面
}
}
}
网页间的传值
传值
Response.Redirect("gerenxiangxi.aspx?id1="啊啊啊啊啊啊"");
接收
string ooo=Request["id1"];
配置文件中添加数据库连接的方法
添加连接
<connectionStrings>
<add name="sqlcon1" connectionString="data source=XWZ\实例2008;initial catalog=yhgl;user id=sa;password=123" />
</connectionStrings>
调用
string constr =ConfigurationManager.ConnectionStrings["sqlcon1"].ConnectionString;
- 仿博客项目整理笔记
- 项目结束,整理一下博客
- 个人博客项目笔记
- 个人项目整理(博客阅读引导)
- 图像搜索项目整理笔记
- 博客整理
- 博客整理
- 整理博客
- 整理博客
- 小巫博客-开源项目整理帖
- Android热门博客社区开源项目整理
- struts2笔记整理第四天(项目实战)
- 系统集成项目管理工程师-笔记整理
- [项目实训]Ajax笔记整理
- 旅游项目笔记(一)问题整理
- 慢慢整理 从笔记转到博客! 2016.9.14
- RandomForest新手自学笔记(多个网站博客整理)
- Spring学习笔记(网易博客整理版本)
- LZW数据压缩算法的原理分析
- 网商备战年末收官战
- 配置SharePoint Foundation 2010基于表单的验证支持
- 实例解析Perl语言中BEGIN和END用法
- ssh使用的jar包介绍
- 仿博客项目整理笔记
- jsoup 解析html网页标签获取数据(java 网页解析 数据)
- ovftool生成的ovf文件在ESX4.1.0上的兼容问题
- 高并发系统数据库设计
- order by field()
- 使用网页开发软件界面
- android 通知栏的实现
- 心得1--自定义连接池与开源组织编写的连接池介绍
- 硅谷创业教父Paul Graham:如何获得创业idea (0) ---原文