vs2010 学习Silverlight学习笔记(18):JavaScript
2010-09-09 20:52
537 查看
概要:
此篇主要学习SL中关于JS的应用。
内容:
4对ajax等的支持,以jQuery为例:
总结:
实验未成功部分较多,关于js的应用还很弱。在对框架学习后,再仔细复习此篇。
此篇主要学习SL中关于JS的应用。
内容:
1使用GetProperty获取脚本对象
对已存在的JS方法调用,比如:
functionHello(message)
{
varresultSpan=$get("result");
resultSpan.innerText="Hello"+message;
}
使用:
ScriptObjecthello=HtmlPage.Window.GetProperty("Hello")asScriptObject;
hello.InvokeSelf(this.input.Text);
2使用CreateInstance创建脚本对象
ScriptObjectscript=HtmlPage.Window.CreateInstance("myHello",this.input.Text);
objectresult=script.Invoke("Display");
3使用HtmlPage.windows.*方法
HtmlPage.Window.Alert(input.Text);//直接输出
HtmlElementr=HtmlPage.Window.Eval("document.getElementById('div')")asHtmlElement;
stringm=r.GetAttribute("innerHTML");
HtmlPage.Window.Alert(m);
4对ajax等的支持,以jQuery为例:
<scripttype="text/javascript">
functionmyHello(message)
{
$("#result").text("Hello"+message);
}
</script>
ScriptObjectscript=HtmlPage.Window.GetProperty("myHello")asScriptObject;
script.InvokeSelf(this.input.Text);
总结:
实验未成功部分较多,关于js的应用还很弱。在对框架学习后,再仔细复习此篇。
相关文章推荐
- vs2010 学习Silverlight学习笔记(8):使用用户控件
- SilverLight学习笔记--Silverligh之在SL中调用Javascript (四种调用方法+简单与复杂参数的传递)
- vs2010 学习Silverlight学习笔记(5):事件响应
- JavaScript学习笔记18-switch语句
- 强大的DataGrid组件[10]_自定义脚模板(FooterTemplate)——Silverlight学习笔记[18]
- ArcGIS API for JavaScript 4.2学习笔记[18] 搜索小部件
- vs2010 学习Silverlight学习笔记(3):一些控件的基本应用
- SilverLight学习笔记--Silverligh之在Javascript中调用.NET(包括简单参数和复杂参数的操作)
- SilverLight学习笔记--Silverligh之在Javascript中捕获和处理Silverlight控件事件
- 韩顺平 javascript教学视频_学习笔记18_js超级玛丽小游戏2_js面向对象的进一步说明
- vs2010 学习Silverlight学习笔记(7):控件样式与模板
- vs2010 学习Silverlight学习笔记(4):界面布局
- vs2010 学习Silverlight学习笔记(17):Dome交互
- js-JavaScript高级程序设计学习笔记18
- JavaScript学习笔记(八)——厚积薄发之成果展
- 【学习笔记】JavaScript(2013-10-06)
- JavaScript学习笔记二——函数
- (7)JavaScript学习笔记 - 运算符(续)
- JavaScript学习笔记-原型继承
- Javascript学习笔记十——网页运行原理