function pageLoad(){var text = new Sys.UI.TextBox($('text'));var label = new Sys.UI.Label($('label'));text.set_text("Hello,worl...">
论坛交流
首页办公自动化| 网页制作| 平面设计| 动画制作| 数据库开发| 程序设计| 全部视频教程
应用视频: Windows | Word2007 | Excel2007 | PowerPoint2007 | Dreamweaver 8 | Fireworks 8 | Flash 8 | Photoshop cs | CorelDraw 12
编程视频: C语言视频教程 | HTML | Div+Css布局 | Javascript | Access数据库 | Asp | Sql Server数据库Asp.net  | Flash AS
当前位置 > 文字教程 > javascript教程教程
Tag:验证,特效,入门,实例,验证,表单,特效,正则表达式,跑马灯,document,函数,代码,getElementByID,菜单,图片,视频教程

javaScript自定义绑定

文章类别:javascript教程 | 发表日期:2008-10-5 17:48:20

<script type = "text/javascript">
        function pageLoad()
        {
            var text = new Sys.UI.TextBox($('text'));
            var label = new Sys.UI.Label($('label'));
            text.set_text("Hello,world!");
           
           
            var binding_1 = new Sys.Binding();
            binding_1.set_dataContext(text);
            binding_1.set_dataPath('text');
            binding_1.set_property('text');
            binding_1.transform.add(customTransform);
           
           
            label.get_bindings().add(binding_1);
            text.initialize();
            label.initialize();
        }
        function customTransform(sender,eventArgs)
        {
            var value = eventArgs.get_value();
            var reverseStr = new Sys.StringBuilder();
            for(var i = value.length - 1;i >= 0;i--)
            {
               
                reverseStr.append(value.charAt(i));
                eventArgs.set_value(reverseStr.toString());
            }
        }
    </script>
</head>
<body onload = "pageLoad();">
    <form id="form1" runat="server">
        <atlas:scriptmanager ID = "scriptmanager" runat="server"></atlas:scriptmanager>
        <div>
            <h3><u>Example 3:</u></h3>
            <div id = "font">
                This example binds the label(a span element) to the text box and <br />
                demonstrates a custom transform to reverse the text from th entered<br />
                value.<br />
                Enter a string:<input type = "text" id = "text" runat = "server" /><br />
                Reversed Text:<label id = "label" runat = "server"></label>
            </div>
          
        </div>
           
    </form>
上一篇:javascript对象与数组的例子 人气:4557
下一篇:javascript切换页面样式 人气:4791
视频教程列表
文章教程搜索
 
Javascript推荐教程
Javascript热门教程
看全部视频教程
购买方式/价格
购买视频教程: 咨询客服
tel:15972130058