`
hyshucom
  • 浏览: 809512 次
文章分类
社区版块
存档分类
最新评论

在Mobile Web Form中使用javascript

 
阅读更多

Mobile Web Form与Web Form的区别:

  Mobile Web Form不支持Theme,但Mobile Web Form可以使用StyleSheet。

  修改(1)的内容:

  当模拟器和Microsoft ActiveSync无法同步时,可以按照下列步骤就可以立即恢复同步。

  1.在Tools->Device Emulator Manager中,选择正在同步的设备右键,选择"Uncradle"。

  2.打开Microsoft ActiveSync,按connect,这时候会出现同步画面。

  3.在Tools->Device Emulator Manager中,选择"Cradle"继续同步。

  Mobile页面上调用所有Asp.net的控件必须订制。

  在Mobile Web Form中使用javascript的方法:

  由于有些手机能够支持javascript,所以只有支持javascript的手机才能显示出效果,所以需要定制,在支持的手机中实现javascript效果。

  涉及代码:

    <mobile:Form id="Form1" runat="server" OnLoad="Form1_Load">

        <mobile:Label ID="Label1" Runat="server" Font-Bold="True">Student Name:</mobile:Label>

        <mobile:TextBox ID="txtStName" Runat="server"></mobile:TextBox>

        <mobile:Command ID="Command1" Runat="server" OnClick="Command1_Click1">Get Info</mobile:Command>

        <mobile:Command ID="Command2" Runat="server">Client Event</mobile:Command>

        <mobile:Panel ID="Panel1" Runat="server">

            <mobile:DeviceSpecific ID="DSP1" Runat="server">

                <Choice Filter="isHTML32" Xmlns="http://schemas.microsoft.com/mobile/html32template">

                    <ContentTemplate>

                    <asp:CheckBox ID="chkBox" runat="server" Text="CheckBox Control" />

                    <Script language="jscript" for="window" event="onload">

                            window.Form1.Command1.onclick = ShowMsg;

                            function ShowMsg(e)

                            {

                                alert("Msg!");

                            }

                        </Script>

                        <Script language="jscript" for="Command2" event="onclick">

                            alert("Msg!");

                        </Script> 

                    </ContentTemplate>

                </Choice>

            </mobile:DeviceSpecific>

        </mobile:Panel>

    </mobile:Form>

  其中在panel中放置定制<mobile:DeviceSpecific ID="DSP1" Runat="server">

  定制条件是只要支持HTML就行<Choice Filter="isHTML32">

  在ContentTemplate中插入script代码,其中for是针对的控件,Mobile Web Form中用window代替document。Event表示对于指定的控件,出现指定的事件时执行scipt中的操作。

  第一个script中,当页面onload的时,执行script,并指定command1的onclick事件。

  第二个script中,只有当command2点击时,才执行script。

  在ContentTemplate中就能添加asp.net控件,更能添加atlas等。

  关于script的属性可以看MSDN的SCRIPT Element | script Object

  里面对script的每个属性,使用方法都有实例。

分享到:
评论

相关推荐

    Building.Cross-Platform.Mobile.and.Web.Apps.for.Engineers.and.Scientists

    Students learn to work with all major mobile and web platforms as this book's active learning approach asks students to type code in parallel as the apps are developed. Meaningful exercises further ...

    Learning Node.js for Mobile Application Development 无水印pdf 0分

    This book is intended for web developers of all levels of expertise who want to deep dive into cross-platform mobile application development without going through the pains of understanding the ...

    jquery mobile 1.1

    all pages in jQuery Mobile are built on a foundation of clean, semantic HTML to ensure compatibility with pretty much any web-enabled device. In devices that interpret CSS and JavaScript, jQuery ...

    DOTNET移动通信程序设计

    ASP.NET保留了大部分ASP的优势,用C#和Visual Basic.NET代替了Javascript和Vbscript,允许Markup语言和C#或Visual Basic.NET语言分别储存在不同的文件中,使ASP时代的Markup语言和Script语言混在一起的情况得到...

    Bootstrap 4 responsive web design

    Bootstrap and web applications 16 Browser compatibility 17 Summary 18 Chapter 2: Creating a Solid Scaffolding 19 Understanding the grid system 19 Building our scaffolding 20 Setting things up 21 ...

    Learn ECMAScript, 2nd Edition-Packt Publishing(2018).epub

    Understanding the fundamentals of JavaScript can not only help a person create interactive web applications but also help set up web servers, create mobile applications through frameworks such as ...

    Material Design implementation with AngularJS(Apress,2016)

    This book is about building high-quality web and mobile user interfaces (UI) that are ... Develop web apps for both mobile and desktop form factors and screen sizes using HTML, CSS, and JavaScript

    【HTML5】\HTML5 Cookbook.(高清本文)pdf

    You get clear solutions for handling issues with everything from markup semantics, web forms, and audio and video elements to related technologies such as geolocation and rich JavaScript APIs. ...

    Ionic in Action(Manning,2015)

    With Ionic, you can do just that: create hybrid mobile apps using web technologies that you already know, like HTML, CSS, and JavaScript, that will run on both iOS and Android. Ionic in Action ...

    deweb2020-05-23 beta2 new2.rar

    使用DeWeb, 开发者不需要学习HTML、JavaScript、Java、PHP、ASP、C#等新知识, 用Delphi搞定一切。 DeWeb开发的网页支持所有客户端,包括手机、平板等。 1 安装控件 先安装vcls目录的icsV858 2 复制dcu 根据...

    Material.Design.implementation.with.AngularJS.UI.Component.Framework

    Develop web apps for both mobile and desktop form factors and screen sizes using HTML, CSS, and JavaScript Table of Contents Chapter 1: Introduction to Angular Material Chapter 2: Getting Started ...

    asp.net知识库

    在ASP.NET中使用WINDOWS验证方式连接SQL SERVER数据库 改进ADO.Net数据库访问方式 ASP.NET 2.0 绑定高级技巧 简单实用的DataSet更新数据库的类+总结 [ADO.NET]由数据库触发器引发的问题 为ASP.NET封装的SQL数据库...

    jquery moble 1.1.0

    all pages in jQuery Mobile are built on a foundation of clean, semantic HTML to ensure compatibility with pretty much any web-enabled device. In devices that interpret CSS and JavaScript, jQuery ...

    HTML5.Programmers.Reference.1430263679

    Learn the new web form features: autofocus, placeholders, field types, etc. Explore the new AUDIO and VIDEO tags, and learn how to embed those rich media types directly into your applications. Use the...

    JS前台框架.rar

    01 bootstrap The most popular front-end framework for developing responsive, mobile first projects on the web. 02 angular.js AngularJS is an MVC framework for building web applications. The core ...

    可扩展表单平台:使用可视化编辑器构建动态Web表单的解决方案

    一种使用可视化编辑器编辑和发布动态Web表单的解决方案,提供使用或从呈现Web表单的react组件,用于编辑动态表单json模式的可视化编辑器组件和服务器库,可帮助您建立动态表单系统。查看文档 :sparkles:特性/功能 :...

Global site tag (gtag.js) - Google Analytics