- 爱易网页
-
ASP.NET教程
- 可定制的IE鼠标右键菜单_评论及其它
日期:2008-12-17 浏览次数:20472 次
using System;
using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Data;
using System.Drawing;
[assembly:TagPrefix("MyWebMenu","zbjg")]
namespace MyTools
{
/// <summary>
/// Summary description for MyWebMenu.
/// </summary>
public class MyWebMenu : System.Web.UI.WebControls.Panel
{
public MyWebMenu()
{
this.BorderStyle = BorderStyle.Outset;
this.BackColor = Color.Silver;
this.BorderWidth= new Unit(2);
}
protected override void Render(HtmlTextWriter writer)
{
base.Render (writer);
writer.RenderBeginTag(HtmlTextWriterTag.Script);
writer.WriteLine("<!--");
writer.WriteLine(" document.getElementById('" + this.ClientID + "').style.position = 'absolute';");
writer.WriteLine(" document.getElementById('" + this.ClientID + "').style.display = 'none';");
writer.WriteLine(" function Hide_MyMenu() {");
writer.WriteLine(" var tempDiv = document.getElementById('" + this.ClientID + "');");
writer.WriteLine(" if(tempDiv.offsetLeft > window.event.clientX + 25) {");
writer.WriteLine(" tempDiv.style.display = 'none'; }");
writer.WriteLine(" if(tempDiv.offsetLeft + tempDiv.offsetWidth < window.event.clientY - 25) {");
writer.WriteLine(" tempDiv.style.display = 'none'; }");
writer.WriteLine(" if(tempDiv.offsetTop > window.event.clientY + 25) {");
writer.WriteLine(" tempDiv.style.display = 'none'; }");
writer.WriteLine(" if(tempDiv.offsetTop + tempDiv.offsetHeight < window.event.clientY - 25) {");
writer.WriteLine(" tempDiv.style.display = 'none'; }");
writer.WriteLine(" }");
writer.WriteLine("");
writer.WriteLine(" function Show_MyMenu() {");
writer.WriteLine(" var tempDiv = document.getElementById('" + this.ClientID + "');");
writer.WriteLine(" tempDiv.style.left = window.event.cli
免责声明: 本文仅代表作者个人观点,与爱易网无关。其原创性以及文中陈述文字和内容未经本站证实,对本文以及其中全部或者部分内容、文字的真实性、完整性、及时性本站不作任何保证或承诺,请读者仅作参考,并请自行核实相关内容。