asp.net右键弹出上下文菜单
xtreeView.js
---==========================================================
var ie5=document.all&&document.getElementById
var ns6=document.getElementById&&!document.all
if (ie5||ns6)
var menuobj=document.getElementById("Panel2")
function showmenuie5(e)
{
document.getElementById("url").value = e.srcElement.firstChild.nodeValue;
var rightedge=ie5? document.body.clientWidth-event.clientX : window.innerWidth-e.clientX
var bottomedge=ie5? document.body.clientHeight-event.clientY : window.innerHeight-e.clientY
//if the horizontal distance isn't enough to accomodate the width of the context menu
if (rightedge<menuobj.offsetWidth)
//move the horizontal position of the menu to the left by it's width
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX-menuobj.offsetWidth : window.pageXOffset+e.clientX-menuobj.offsetWidth
else
//position the horizontal position of the menu where the mouse was clicked
menuobj.style.left=ie5? document.body.scrollLeft+event.clientX : window.pageXOffset+e.clientX
//same concept with the vertical position
if (bottomedge<menuobj.offsetHeight)
menuobj.style.top=ie5? document.body.scrollTop+event.clientY-menuobj.offsetHeight : window.pageYOffset+e.clientY-menuobj.offsetHeight
else
menuobj.style.top=ie5? document.body.scrollTop+event.clientY : window.pageYOffset+e.clientY
if(ie5)
window.event.cancelBubble = true;
else if(ns6)
e.stopPropagation();
menuobj.style.visibility="visible"
return false
}
function hidemenuie5(e){
menuobj.style.visibility="hidden"
}
function highlightie5(e){
var firingobj=ie5? event.srcElement : e.target
if (firingobj.className=="menuitems"||ns6&&firingobj.parentNode.className=="menuitems"){
if (ns6&&firingobj.parentNode.className=="menuitems")
firingobj=firingobj.parentNode //up one node
firingobj.style.backgroundColor="highli
相关文档:
更新:2007 年 11 月 可以像对 HTML 元素那样,以声明方式向 ASP.NET 网页上的控件添加客户端脚本。或者,如果事件或代码依赖仅在运行时可用的信息,可以通过编程方式向 ASP.NET Web 服务器控件添加客户端脚本事件。 说明: 可以在客户端脚本中通过 ID 引用控件。有关更多信息,请参见 ASP.NET 网页中的客户端脚本。 向 ......
using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
/// <summary>
/// 声明委托
/// </summary>
/// <param name="name"></param>
public delegate void GreetPeopleDelegate(st ......
//数字字符
public static string KeepNum(string str)
{
char[] tmp = new char[str.Length];
char[ ......
1.采用 HTTP Module 控制页面的生命周期。
2.自定义Response.Filter得到输出流stream生成动态页面的静态内容(磁盘缓存)。
3.页面GZIP压缩。
4.OutputCache 编程方式输出页面缓存。
5.删除页面空白字符串。(类似Google)
6.完全删除ViewState。
7.删除服务器控件生成的垃圾NamingContainer。
8.使用计划任务按时生成 ......
验证码页面后台Code.aspx.cs代码:(已经将验证码存于session中session["code"],可在调用页面直接读取session)
using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Web.UI.WebCon ......