您的位置:首页 > 其它

Behavior模型应用:可拖动的div容器

2008-02-22 21:58 453 查看
VS 2008

应用Asp.Net Ajax behavior模型,做了一个简单的可拖动的div ^_^

1. html页面

<%@ Page Language="C#" AutoEventWireup="true" CodeFile="Default.aspx.cs" Inherits="_Default" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">

<head runat="server">

<title>Untitled Page</title>

</head>

<body style="margin:0px;">

<form id="form1" runat="server">

<asp:ScriptManager ID="sMgr" runat="server">

<Scripts>

<asp:ScriptReference Path="~/Behaviors/DragBehavior.js" />

</Scripts>

</asp:ScriptManager>

<div id="divDrag" style="position:fixed; width:500px;height:200px;border:solid 1px #000000;">

<ul style="list-style:none; margin:0px; padding:0px;">

<li style="height:30px; background-color:#cccccc;"></li>

<li>

</li>

</ul>

</div>

</form>

<script type="text/javascript">

</script>

</body>

</html>

2. client behavior javascript library

Type.registerNamespace("Tristan");

Tristan.DragBehavior.registerClass('Tristan.DragBehavior', Sys.UI.Behavior);

if (typeof(Sys) !== 'undefined') Sys.Application.notifyScriptLoaded();
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: