javascript事件驱动框架 收藏
javascript事件驱动框架 收藏
一个简单的事件驱动框架的演示:
/*ControlDemo.js*/
//事件驱动框架(演示)
function ControlDemo(page)
{
//初始化Page
if (page == null)
{
page = self;
}
if (page != self)
{
//Do sth. here...
}
this.page = page;
//Properties
this.keyPressed = 0;
//Controlable Entities
//PageBody
this.body1 = page.document.getElementById("main");
page.PageLoadEventSender = this;
this.body1.onload = function(){this.PageLoadEventSender.PageLoad(this.PageLoadEventSender,page.event);}
//Button1
this.button1 = page.button1;
this.button1.value = "确定";
this.button1.ClickEventSender = this;
this.button1.onclick = function(){this.ClickEventSender.Button1_Click(this.ClickEventSender,page.event);}
//Button2
this.button2 = page.button2;
this.button2.value = "取消";
this.button2.ClickEventSender = this;
this.button2.onclick = function(){this.ClickEventSender.Button2_Click(this.ClickEventSender,page.event);}
//Textbox1
this.textbox1 = page.textbox1;
this.textbox1.style.width = "100%";
this.textbox1.rows = 10;
this.textbox1.KeyUpSender = this;
this.textbox1.onkeyup = function(){this.KeyUpSender.Textbox1_KeyUp(this.KeyUpSender,page.event);}
this.textbox1.MouseMoveSender = this;
this.textbox1.onmousemove = function(){this.MouseMoveSender.Textbox1_MouseMove(this.MouseMoveSender, page.event);}
//Labels
this.label1 = page.document.getElementById("label1");
this.label2 = page.document.getElementById("label2");
this.label3 = page.document.getElementById("label3");
//EventHandlers
this.PageLoad = function(sender,event)
{
this.page.defaultStatus = "事件驱动框架演示~~";
this.page.resizeTo(600,400);
}
this.Button1_Click = function(sen
相关文档:
jQuery, MooTools, Prototype 等优秀的
JavaScript 框架拥有各种强大的功能,包括绘制 Web 图表,使用这些框架以及相应插件,我们可以非常轻松地实现曲线图,圆饼图,柱状图等
Web 图表的绘制,而不必象以往那样通过复杂的 Flash 技术实现。本文介绍了9个优秀的基于 JavaScript 与 CSS& ......
function checkfiletype()
{
var fileName = document.getElementById('<%=FilePath.ClientID%>').value;
if (Trim(fileName)=="")
{
alert("请选择要上传的文件!");
......
用Javascript实现根据下拉列表category的选择结果,改变下拉列表sub_category的选项
<mce:script language="javascript" type="text/javascript">
<!--
function changeSubCategory() {
var sel_category = document.getElementById("category");
var sel_sub_category = document.getElementById("sub_c ......
<script>
///用户数据结构
function _tagUser()
{
this.UserId = 0; //0-4
this.UserName = ""; //5-
this.Parse = function(VarTypeUser)
{
for (var i=0;i<VarTypeUser.length;i++)
VarTypeUser[i] = String.fro ......