AppleSeeker's Tech Blog
Welcome to AppleSeeker's space
posts - 84,  comments - 767,  trackbacks - 6

补充在(2)中的内容:

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的每个属性,使用方法都有实例。

posted on 2006-12-22 15:30 AppleSeeker(冯峰) 阅读(3479) 评论(4) 编辑 收藏

FeedBack:
2006-12-23 03:04 | Henry Liang      
Wow,我见过的很多mobile devices对js和css的支持都很有限。WM5看来是很强大。
 回复 引用 查看   
#2楼[楼主]
2006-12-23 11:22 | appleseeker      
@Henry Liang
只要能够显示HTML的,javascript基本上都能支持.

 回复 引用 查看   
2007-01-16 16:47 | wayne[未注册用户]
我现在碰到的问题是在mobile:TextBox中输入后按回车,结果不是提交form,而是不停的在切换软键盘的关闭/开启,请问有没有办法解决
 回复 引用   
#4楼[楼主]
2007-01-17 14:54 | appleseeker      
@wayne
设置form的Action属性,将Action属性设置为某个需要提交的页面后,在TextBox上自然按回车后会提交这个表单。

 回复 引用 查看   
Free Hit Counter

MSN:appleseeker@hotmail.com
Mail:appleseeker@gmail.com MVP


【新品特价】SPORTICA 防水商务10春新款内里绒夹克外套03409081
[YT001]深层去斑美白去斑套餐 去黑淡痘印 最好最热产品日销千套
昵称:AppleSeeker(冯峰)
园龄:6年6个月
粉丝:33
关注:3

<2006年12月>
262728293012
3456789
10111213141516
17181920212223
24252627282930
31123456

搜索

 

常用链接

最新随笔

我的标签

随笔分类(124)

随笔档案(84)

Mobile Blog

Recommend Blog

  • 李占卫

Recommend Site

  • Green IT

积分与排名

  • 积分 - 230243
  • 排名 - 351

最新评论

阅读排行榜

评论排行榜

推荐排行榜