silverlight与javascript交互操作
	
    
    
	在silverlight开发中,我们可以使用js来调用silverlight中的方法(当然方法上要捆绑相应属性),也可以将指定
的js方法绑定到silverlight应用中的事件上.本DEMO演示了通过js调用完成silverlight数据列表控件(DataGrid)的数
据绑定操作,并通过DataGrid的EmployeeList_BeginningCellEdit事件将当前选取的数据行信息返回到js所绑定的
事件参数上,并调用该js方法显示选中数据行信息,如下图所示:
            
   
     下面介绍一下主要的开发过程:)
   
     首先,我们需要建立一个Silverlight Application ,名称为:Silverlight_JS_call.
   
     然后我们要在当前的项目中加入一个类文件,名称为:EmployeeInfo.cs.
   
     下面是相应的代码,相关内容见注释:   
[ScriptableType]
public class EmployeeInfo
{
    /// <summary>
    /// 雇员编号
    /// </summary>
     [ScriptableMember]
    public int EmployeeNo { get; set; }
    /// <summary>
    /// 雇员名称
    /// </summary>
     [ScriptableMember]
    public string EmployeeName { get; set; }
    /// <summary>
    /// 地址
    /// </summary>
     [ScriptableMember]
    public string Address { get; set; }
}
/// <summary>
/// 雇员事件参数(用于完成与js绑定事件参数)
/// </summary>
[ScriptableType]
public class EmployeeInfoEventArgs : EventArgs
{
     [ScriptableMember]
    public EmployeeInfo employeeInfo{ get; set; }
}
/// <summary>
/// 要注册并在页面中使用的js调用脚本对象
/// </summary>
[ScriptableType]
public class JavaScriptableObject
{
&nb
    
     
	
	
    
    
	相关文档:
        
    
    上回说到,操作Object Array
其实还可以这样操作:
var Room = [
            {
                ID: 'bot',
                name: 'test' ......
	
    
        
    
    首先设置IE,   依次选择 工具-> Internet   选项->   高级, 找到 浏览 下的两个禁用脚本调试复选框, 将其取消选择(IE默认将这两项选中, 不能进行脚本调试),  
1. 调试JS脚本文件(*.js文件)
直接在JS文件中F9设置断点, F5运行调试即可.
2. 调试页面文件中脚本(*.aspx中JS脚本)
 ......
	
    
        
    
     var vKeyCode= e.getKeyCode();
          if (vKeyCode >=   65   &&  vKeyCode  <=   90   ) // Caps Lock 打开
             {
 ......
	
    
        
    
    
JavaScript gives HTML designers a programming tool - HTML authors are normally not programmers, but JavaScript is a scripting language with a very simple syntax! Almost anyone can put small "snippets" of code into their HTML pages
JavaScript can put dynamic text into an HTML page - A Ja ......
	
    
        
    
    <html>
    <head>
        <mce:style><!--
            .tvline{width:240px;height:180px;border:0;}
            .tvline td{border-top:1 solid #000000;font:1px;filter:alpha(opacity=30)}
        
--></mce:style><style mce_bogus="1">            .tvline{width:240p ......