asp.net常用的javascript经典例子
自己在开发中碰到的+了一些在网上搜到的。。和大家分享下。
Dropdownlist无刷新的例子。xml.
例如文本验证!
下面是一个单选按纽前台不刷新的例子.有好的就往上贴
<mce:script language="javascript"><!--
function SetButton()
{
if(document.all.rdoByHuman.checked==true)
{
document.all.cboHrPut.disabled = "";
document.all.cboAnswerHr.disabled = "";
document.all.cboGroup.disabled = true;
}
if(document.all.rdoByGroup.checked==true)
{
document.all.cboHrPut.disabled = true;
document.all.cboAnswerHr.disabled = true;
document.all.cboGroup.disabled = "";
}
}
// --></mce:script>
<asp:RadioButton id="rdoByHuman" onclick="SetButton();" runat="server" GroupName="TotalGroup" Checked="True" Text="按人员"></asp:RadioButton>
e.Item.Attributes.Add("onmouseOver","this.style.backgroundColor='#dee3e7'");//鼠标移上去的颜色
e.Item.Attributes.Add("onmouseOut","this.style.backgroundColor='white'");
e.Item.Cells[2].Attributes.Add("onmouseOver","this.style.backgroundColor='red'");
e.Item.Cells[2].Attributes.Add("onmouseOut","this.style.backgroundColor='white'");//指定某列的颜色
e.Item.Cells[3].Style["cursor"]="hand";
e.Item.Cells[4].Attributes.Add("onclick","alert('你惦记的ID 是:"+e.Item.Cells[4].Text+"');");//指定显示字段
e.Item.Cells[1].Attributes.Add("title","'红孩是未解决的,蓝精灵是已解决的!'"+e.Item.Cells[0].Text.ToString());//显示title
e.Item.Cells[0].Attributes.Add("onclick","window.open('xinxiForm.aspx?idmain="+e.Item.Cells[0].Text+"','','ToolBar=no,width=260,height=200');");
屏闭一些键:
function KeyDown(){ //屏蔽鼠标右键、Ctrl+n、shift+F10、F5刷新、退格键
//alert("ASCII代码是:"+event.keyCode);
if ((window.event.altKey)&&
((window.event.keyCode==37)|| //屏蔽 Alt+ 方向键 ←
(window.event.keyCode==39))){ //屏蔽 Alt+ 方向键 →
a
相关文档:
以前没有遇到,今天以前同事问这个问题,整出来做为收藏
直接贴代码:
protected void Page_Load(object sender, EventArgs e)
{
Response.Write(SenFe_Replace("沉下心去做好每一件事_2010_2_1_asp.net_你一定行"));
& ......
1. 长度限制
<script>
function test()
{
if(document.a.b.value.length>50)
{
alert("不能超过50个字符!");
document.a.b.focus();
return false;
}
}
</script>
<form name=a onsubmit="return test()">
<textarea name="b" cols="40" wrap="VIRTUAL" rows="6"></textarea&g ......
项目中有一些报表,本身速度就不太快,遇到数据量大的情况,更是让人抓狂,用户也提出了报表速度慢的问题,于是想着如何实现报表的数据依赖缓存,即将报表数据缓存,当数据发生改变时,再重新获取数据。
最简单的方法,是在显示报表的aspx页面第一行加上形如<%@ OutputCache Duration="600" VaryByParam="some_par ......
方法1:
Response.Cookies["username"].Value="gjy";
Response.Cookies["username"].Expires=DateTime.Now.AddDays(1);
方法2:
System.Web.HttpCookie newcookie=new HttpCookie("username");
newcookie.Value="gjy";
newcookie.Expires=DateTime.Now.AddDays(1);
Response.AppendCookie(newcookie);
创建带 ......
计划推出的《ASP.NET实战笔记》,提纲如下: 第一篇 典型的网站架构解决方案
第1章 系统目标
1.1 需求分析
1.2 系统目标
第2章 系统功能预览
2.1 用户管理
2.1.1. ......