学习 JavaScript, jQuery, ASP.NET MVC

即梦AI使用教程 摘要: 即梦AI是字节跳动推出的多模态AI创作平台,整合图片、视频、智能编辑功能,基于OmniHuman模型支持中英日三语操作。核心特点包括: 技术升级:4.0版本强化中文语义理解与微观表现力,新增故事分镜生成; 创作功能:支持文本/图片转视频、AI对口型、商业级抠图与多图层融合; 用户友好:移动/网页双端适配,灵感社区复用提示词,剪映生态无缝衔接; 应用场景:覆盖电商换装、虚拟主播、设计融合等需求,未来将开放API拓展生态。 (字数:149) 阅读详情

 

      因为工作的原因,要开始学习JavaScript的基础知识,经人介绍选择了《JavaScript权威指南(第6版)》作为入门的指导丛书,呵呵!很喜欢第一张第一段对JavaScript、HTML和CSS这个Triad的精辟描述:

  • HTML to specify the content of web pages,
  • CSS to specify the presentation of web pages
  • JavaScript to specify the behavior of web pages.

 

=== 表达式和语句的关系===

An expression is a phrase of JavaScript that a JavaScript interpreter can evaluate to produce a value. If the phrases of JavaScript are expressions, then the full sentences are statements. JavaScript statements are terminated with semicolon. Expressions are evaluated to produce a value, but statements are excuted to make something happen.

 

=== Closure ===

  什么是closure?  closure是Javascript语言的重要概念是之一,如果不理解这个概念,会影响后面对jQuery Plug-in等概念的学习。但对于像我这样初学者而言,很难能一下子准确把握其含义,特别是书上那些拗口的定义, 例如:"Closure is yet another element from Lisp that has migrated into Javascript. When a function is created in Javascript, the function has access to any lexically scoped variables that were in the environment that created it." 摘自《Programming HTML5 Applications》。

       这里有篇好文章 Closures , 由浅入深介绍了closure的概念 : "A closure is a special kind of object that combines two things: a function, and the environment in which that function was created. The environment consists of any local variables that were in-scope at the time that the closure was created." 

       在下面的例子中,add5和add10就是两个closure。它们不仅代表一个function,同时还关联着一个environment,这个environment中保留了add5和add10在被创建时所能够访问到variable,如:x。这有就是为什么,makeAdder退出后,add5和add10仍能够访问x。

<!DOCTYPE html><html xmlns="http://www.w3.org/1999/xhtml"><head> <title>Learning JavaScript Concept - Closure</title> <script src="http://ajax.aspnetcdn.com/ajax/jQuery/jquery-1.8.0.js"></script> <script> $(document).ready(function () { // makeAdder is a factory function function makeAdder(x) { return function (y) { return x + y; }; }; // add5 is a closure var add5 = makeAdder(5); // add10 is another close var add10 = makeAdder(10); var list = "<li> Call add5(1) = " + add5(1) + "</li>"; list += "<li> Call add10(1) = " + add10(1) + "</li>"; $("#list").html(list); }); </script></head><body> <ul id="list"> </ul></body></html>

 

=== Anonymous function? ===

 Javascript anonymous function. 

"Variables are scoped at the function level in javascript. This is different to what you might be used to in a language like C# or Java where the variables are scoped to the block. What this means is if you declare a variable inside a loop or an if statement, it will be available to the entire function."

 

=== 什么是self-invocation pattern? === 

 Self-invocation 

"Self-invocation (also known as auto-invocation) is when a function executes immediately upon it’s definition. This is a core pattern and serves as the foundation for many other patterns of JavaScript development."

"In an effort to protect the global object, all JavaScript applications should be written within a self-invoking function. This will create an application scope in which variables can be created without the fear of them colliding with other applications."

 

=== Javascript strict mode ===

 'use strict' :  IE10 才支持。

 

=== ASP.NET MVC 4 - Bundles ===

Bundling and Minification(F12, Debugging, EnableOptimizations),ScriptBundle, StyleBuddle.

Bundles set the HTTP Expires Header one year from when the bundle is  created. If you  navigate to a previously viewed page, Fiddler shows IE does not make a  conditional request for the bundle, that is, there are no HTTP GET requests from  IE for the bundles and no HTTP 304 responses from the server. You can force IE  to make a conditional request for each bundle with the F5 key (resulting in a  HTTP 304 response for each bundle). You can  force a full refresh by using^F5 (resulting in a HTTP 200 response for each bundle

 

=== Razor : SiteLayout.cshtml, _viewStart.cshtml @RendorSection() ===

ASP.NET MVC : Layout with Razor 

" Razor includes a new feature that enables us to remove the need to explicitly set the Layout in each view – and instead allows us to define the layout logic once for all views in the site – making our view files even cleaner and more maintainable (and ensuring we keep to the DRY principle: Don’t Repeat Yourself). "  ------  通过定义 _ViewStart.cshtml 文件,并将其放置在 \views 文件夹下这样就可以为所有view定义Layout了。

 

=== HTTP 304 === 

HTTP Status Code Definitions,Get Rid of HTTP 401 and HTTP 304 

(In generalHTTP 304 is returned by web server when the browser is not really sure about up-to-date’ness of the resource)

 

=== JavaScript : No Class but constructor ===

There are no classes in JavaScript and this allows for great flexibility, because you don't have to know anything about your object in advance; you don't need a class "blueprint".

 

=== JSON - JavaScript Object Notation ===

It's only a combination of the array and the object literal notation. The only syntax differenc between JSON and the object literal is that property names need to be wrapped in quotes to be valid JSON. Here is a JSON string example :  {"Name" : "Jeffrey", "Some" : [1, 2, 3] } . In JSON strings, you cannot use functions or regular expression literals.JSON.parse() andJSON.stringify() are natively supported by the JavaScript engine in modern browsers, such as IE. jQuery has jQuery.parseJSON but no the opposite operation ?

To convert a JSON text into an object, you can use the eval() function. It invokes the JavaScript compiler. Since JSON is a proper subset of JavaScript, the compiler will correctly parse the text and produce an object structure. The text must be wrapped in parens to avoid tripping on an ambiguity in JavaScript's syntax.  

var myObject = eval('(' + myJSONtext + ')');

The eval function is very fast. However, it can compile and execute any JavaScript program,so there can be security issues. The use of eval is indicated when the source is trusted and competent. It is much safer to use a JSON parser

Chainability - Understand the chainiFrame memory in IE,Lost Focus http://blog.csdn.net/liaobc/article/details/7887238

JQuery  blur()

             The blur event fires when an element loses focus either via the pointing device or by tabbing navigation.

        this.each()

jQuery supports "chainable methods", which means that most jQuery functions should return this. .each() returns this, and if you want $('selector').yourPlugin().css(...) to work, you should return this.

 

=== Knockout.js ===

       jQuery作为一种通用的JavaScript框架使JavaScript编程变得容易和简洁很多,但是它在解决一些特定问题时还是有捉襟见肘的时候,比如:数据与UI元素的绑定。Knockout.js就是专门针对数据与UI元素绑定的框架,它使得这种绑定的代码更简洁。Beginners Guide  to Knockout.js : Part 1 ,Part 2Part 3,是不错的入门好文。KnockoutJS 与ASP.NET MVC结合的视频, 还有MVC Techniques with JQuery,JSON and Knockout.js

       knockout优点之一就是,它使用data-bind属性建立数据和界面元素的绑定关系,避免了直接与DOM元素耦合在一起,HTML结构的改变不会影响绑定,例如:

<p>The day of the week is <span data-bind="text: dayOfWeek"></span>. It's time for <span data-bind="text: activity"></span></p> 
function viewModel() {
  this.dayOfWeek = ko.observable('Sunday');
  this.activity = ko.observable('rest');
};
ko.applyBindings(new viewModel());

 

       要真正用好knockout, 还需要对MVVM模式有所了解,Understanding MVVM - A Guide For Javascipt Developers 是不错的介绍文章,下面的概述非常点睛 :

MVVM (Model View ViewModel) is an architectural pattern based on MVC and MVP, which attempts to more clearly separate the development of user-interfaces (UI) from that of thebusiness logic and behaviour in an application. To this end, many implementations of this pattern make use of declarative data bindings to allow a separation of work on Views from other layers.

This facilitates UI and development work occurring almost simultaneously within the same codebase. UI developers write bindings to the ViewModel within their document markup (HTML), where the Model and ViewModel are maintained by developers working on the logic for the application.

 

=== altJS ===

           这年月新词汇太多了,稍不小心就OUT了。altJS应该说的是JavaScript的替代品, 参看CoffeeScript vs. TypeScript vs. Dart。?????? JavaScript有什么不好,为啥要替代了人家??????

 

=== Require.js ===

           Modular Javascript with  RequireJS 主要是用来弥补JavaScript语言对模块化编程(Modular Programming)支持的不做。在没有RequireJS时候,开发人员主要是依赖于<script>标签,来定义并加载一系列需要的JavaScript文件。这种方式对于使用少量的JavaScript文件的应用来说是有效的,但对于使用大量JavaScript文件的应用而言,维护的成本和复杂度是非常大的。同时,采用<script>也会带来性能方面的影响,用户需要等待所有文件加载完毕后才能使用该应用。

RequireJS使用带来了两点好处: 1. 清晰的模块定义;2. 模块异步加载的性能提升;

          RequireJS Org Doc

          RequireJS Doc API 上面两篇文章适合在接触过RequireJS的初学者入门使用,而这边RequireJS自己的文档,更是适合需要具体了解RequireJS细节的开发人员阅读。它更详细地介绍了,RequireJS的方方面面,具体到API的使用和配置等。特别是Require() API在加载时,对非Module类型的JavaScript文件的处理等。

      RequireJS/Text 是一个用来加载文字内容的插件。

      RequireJS使JavaScript代码有个更好的模块化结构,但是如果对这样的代码进行单元测试呢? 特别如果屏蔽掉模块的外部依赖呢?http://fragphace.pl/blog/2013-03-13-Mocking-requirejs-dependencies 是不错的入门好文。

 

=== Backbone.js === 

Getting Started with Backbone.js 

" Backbone supplies structure to JavaScript-heavy applications by providing models with key-value binding and custom events, collections with a rich API of enumerable functions, views with declarative event handling, and connects it all to your existing application over a RESTful JSON interface."

 

" Backbone provides a clean way to surgically separate your data from your presentation. The model that works with the data is only concerned with synchronizing with a server while the view’s primary duty is listening to changes to the subscribed model and rendering the HTML "

 

=== Knockback ===

疑问  Can Knockback be used to handle complicated data object, where the object is nested with collections?疑问

 

Getting Started with Knockback.js

In essence, Knockback.js bridges the dynamic DOM bindings ofKnockout.js with the models, computeds, and routers ofBackbone.js. It also brings some other cool features like localization, default values, and nested view models!

 

Tutorial : Getting started with knockback.

" You can use Knockback to bind Backbone Models/Collections to your HTML/templates (View) using Knockout. "

 

2-Way Databanding using Knockout and Backbone

" Knockback is a fantastic little “bridge” library that brings together the MVP structure of Backbone and the magical data-binding goodness ofKnockout.  The library doesn’t replace either one, but just smoothes over the rough edges where they stomp on each other, allowing you to create a Knockout ViewModel from a plain old Backbone.Model."

 

=== Bootstrap ===

How to use Twitter bootstrap to create a responsive web design?

" At the core of Bootstrap is a set of basic HTML elements that have been styled to allow for easy enhancement via classes and user styles."
 

=== MEF ====

Get started with MEF

" The Managed Extensibility Framework or MEF is a library for creating lightweight, extensible applications. It allows application developers to discover and use extensions with no configuration required. It also lets extension developers easily encapsulate code and avoid fragile hard dependencies. MEF not only allows extensions to be reused within applications, but across applications as well. "

 

==== HTTP/HTTPS ====

The First Few Milliseconds of an HTTPS Connection

 

 

Reference

  1. Writing Fast, Memory Efficient JavaScript
  2. JavaScript and Memory Leak 
  3. Closures in JavaScript
  4. How to author a jQuery plug-in 

.NET中实现后台调用前台JavaScript方法和传递参数 通过上述方法,我们可以在.NET开发中实现后台调用前台JavaScript方法并传递参数。在ASP.NET WebForms中,我们使用ScriptManager控件和PageMethods对象来实现;在ASP.NET MVC中,我们使用JsonResult类型的Action方法和ajax方法来实现。在.NET开发中,经常需要在后台代码中调用前台JavaScript方法,并传递参数。这种情况下,我们可以借助ASP.NET WebForms或ASP.NET MVC框架提供的一些技术来实现。 阅读详情

相关推荐

模型实战(32)之 yolo26 实现对全身关键点数据集 的训练与关键点检测

模型实战(32)之 yolo26 实现对全身关键点数据集 的训练与关键点检测

yohnyang的博客 72

ASP.NET MVC使用javascript

在母版页,也就是布局页,使用 @if (IsSectionDefined("SubMenu")) { @RenderSection("SubMenu", required: false) } SubMenu:这个名字随便取 在需要用脚本的地方 @section SubMenu{ <script src="~/js/submenu.js"></script> } 就完成了。 ...

一杯浊酒笑风尘 2032

(2009-2024年)上市公司-漂绿数据

1、资源内容地址:https://blog.csdn.net/2301_79696294/article/details/1462614042、数据特点:今年全新,手工精心整理,放心引用,数据来自权威,且标注《数据来源》,相对于其他人的控制变量数据准确很多,适合写论文做实证用 ,不会出现数据造假问题3、适用对象:大学生,本科生,研究生小白可用,容易上手!!!4、课程引用: 经济学,地理学,城市规划与城市研究,公共政策与管理,社会学,商业与管理

asp.net mvcJavaScript ajax使用(刚学不久,想必很菜,希望对刚学的同学有用)

这是第一次记录文章

u012935474的专栏 337

ASP.NET MVC 引入JavaScript(.JS)文件

 <script src="<%=Url.Content("~/Scripts/jquery-1.4.2.min.js") %>" type="text/javascript"></script><br /> <script src="<%= Url.Content("~/Scripts/jquery-1.3.2.min.js")%>" type="text/javascript"></script> <br /> <br />

超越梦想... 7370

ASP.NET MVC将模型数据传给JavaScript函数问题

使用APS.NET MVC编写页面,在Html中为javascript函数传入的参数为动态数据时,要注意将动态参数放在引号中,如下面代码中超链接的add函数所示。 <tbody> @{ int i = 1;} @foreach (Permission p in Model) { <tr> <td><input type="c...

每天进步一点点 748

网站资料收集 主要查看js的学习部分

1、Asp.Net MVC3.0基本的简单的可能都会用,更深入的使用还需加深研究,之后希望对MVC4.0和5.0进行对比学习,暂时看到@葡萄城控件技术团队博客的MVC5系列正在继续http://www.cnblogs.com/powertoolsteam/tag/MVC/。 2、JavaScriptjQuery基本的也会不少,通常都是用啥百度、google然后差不多就出来了,之后要系统学习下,...

weixin_33834137的博客 111

Web前端工作2个月小结

开始语: 2013年6月30日,Microsoft Learning support 项目结束,转而进入Forerunner Development 项目,这对于这块领域空白的我,空前的困难,可是我坚信事在人为!于是乎,开始了我的Web 前端的征程……   首先,为了能快速加入这个项目,我提前开始了HTML5+CSS3+JavaScript+jQuery学习   其次,为了能快速适应这个项目...

weixin_30810239的博客 236

10多种JavaScriptjQuery MVC教程

自2011年已接近尾声,我们即将面对另一品牌新的一年在几个星期内,我们认为我们会给你提供超过10个的JavaScript的收集和jQueryMVC教程 ,你可能愿意学习之前2012年MVC FTW! 玩得开心! jQueryMVC 1. AJAX - 春MVC 3和jQuery集成 在本教程中,我们将建立与使用jQuery AJAX功能的简单的Spring MVC 3应用程序。 我们...

545

如何高效的利用博客园?

写在前面 在河南工作那会儿,虽然遇到问题也百度过,google过,但是很少留意内容来自哪个网站,也许是工作的内容太简单了,也许是太单调了,之后的之后就很少上网查东西了,因为模块相似,功能相似,代码写了n遍了。真不用了!后来也因为合同到期了,就选择了让我向往已久的北京。 来了北京后,发现自己其实很菜,之前那种玩法都是小儿科。不得不重新充实自己。然后就是不断的学习,不断的提高,一个偶然的...

banfu7150的博客 161

ASP.net MVC4 + HTML5 + JS 学习

1、MVC The Official Microsoft ASP.NET Site http://www.asp.net/mvc 2、跟我一起学习ASP.NET 4.5 MVC4.0 http://www.cnblogs.com/xdotnet/archive/2012/03/05/aspnet_mvc40_preview.html 3、codeproject - ASP.NE...

v5browser 246

分享16个javascript&jQueryMVC教程

日期:2011/12/19 来源:GBin1.com 2011即将过去我们将在几周后迎来新的一年。 这里我们将介绍10多个js和jQueryMVC教程希望大家喜欢! jQuery MVC 1. AJAX - Spring MVC 3和jQuery的整合 这个教程中我们将使用jQuery的AJAX机制开发一个简单的Spring MVC3应用。我们将介绍如何使用jQuery.post()方...

weixin_30832405的博客 90

2009年自我总结

转眼之间,又是一年过去。2010年的第一个月就剩这最后一天。也该为自己的2009总结总结了,为今年计划计划。 回想2009年,就这样匆匆的过去了。看看自己在2008年末为自己定的计划,好多都没有达到预期的目标。虽说有工作上的原因(加班比较多,平时学习的时间少了),自身也有原因(计划的执行力不够),计划制定也不够细(制定了大的目标,没有进行任务分解,设置里程碑)。原因种种,希望能在2010...

dengqi4009的博客 145

前端工程师的三个学习阶段

阶段一:前台工程师 1. 入门:html 2. 进阶:css 3. 中级: JavaScript 4.高级: 活学活用,三者结合,大量实践 5.高手: jQuery(是JavaScript操作html和css的利器) 6.终极: PS+FLASH。 如果JavaScript学的好,可以顺便学一下 Action Script 阶段二: Net后台工程师 1. 初级: Acces...

weixin_30346033的博客 210

asp.net、html、javascript等比较有用的网站

Learn模块下web、mvc、razor等。 http://www.asp.net/ 包括html、javascriptjquery、xml等教程。 http://www.w3school.com.cn/ jq-school.com MSDN官网 技术性问题等基本上都能搜到答案。 http://msdn.microsoft.com/ http://www....

weixin_30260399的博客 77

B/S总结

前言    从牛腩,HTML,XML,asp.net,javascript,css,jqery到ajax,B/S模块的学习结束啦!这段时间,伴随着视频、demo和真正项目的历练,突然觉得这些基础真的太重要了,之后的那些框架啊技术啊都是在这些基础之上建立的!结束之际,做一个总结!框架    一开始牛腩新闻发布系统用的就是纯三层(U、B、D),后来做库房管理系统用的是MVC框架+三层,其实就是将U层划

不会英语的程序员不是好开拓者 508

走过1314

2013年的最后一天,简短的写个总结,仅此而已。 上一篇随笔中,我提到今年要换个公司,涨点工资,这个目标已经实现了,但是明年我还有更多和更大的目标需要去实现。 很高兴在今年的尾声终于加入到了ASP.NET MVC的项目中工作,还用到了WCF技术和Oracle数据库,但都还只是刚接触而已,明年的首要任务就是熟练地去掌握这些技术,能够达到更熟练的去运用,遇到问题能够快速独立...

weixin_30839881的博客 122

ajaxpro post html,c# - Call ASP.NET function from JavaScript? - Stack Overflow

Static, strongly-typed programming has always felt very natural to me, so at first I resisted learning JavaScript (not to mention HTML and CSS) when I had to build web-based front-ends for my applicat...

weixin_31099497的博客 224

.NET Web开发技术简单整理

在最初学习一些编程语言、一些编程技术的时候,做的更多的是如何使用该技术,如何更好的使用该技术解决问题,而没有去关注它的相关性、关注它的理论支持,这种学习技术的方式是短平快。其实工作中有时候也是这样,公司要推崇一个新技术、一个解决方案,我们总是短平快的去学习如何使用它,按照固定的解决问题思路按着案例进行,这也是一种应对项目紧急的一些措施。 个人感觉如果有空闲时间的话,还是分析一下、理解一下、深入了

815

12.19.2016 下半年技术小结

下半年课蛮重的,加上心思比较野,在学习新东西上对自己比较失望 课业: ASP.NET MVC开发:MyStore购物网站 和 SSLS 图书馆管理网站(由于用的mac,只能在学校电脑写.NET,真的蛋疼) 前端:加深jquery和bootstrap的理解和运用 汇编语言:从无到有 有空闲想看看react.js 转载于:https://www.cnblogs.com/ma...

weixin_30611509的博客 84

SHAREPOINT 2016 & 2013 DEVELOPER TRAINING

OVERVIEW course explores the development opportunities available with SharePoint Onpremises using either SharePoint Server 2016 and SharePoint Server 2013. Students will learn about the tradeoff...

dianzhuoxing1136的博客 228
上一篇: 介绍 Windows Azure Role Architecture 的文章
下一篇: Powershell - Failed to enumerate SSL bindings, error code 234
quicknet
博客等级 码龄25年 398粉丝 117原创
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值