10 2012 档案
摘要:Object-Oriented JavaScriptDynamic ObjectsCreating dynamic object is very similar in c# and JavaScriptBoth c# and JavaScript can add new properties dynamicallyIn JavaScript, we use FUNCTION to define a classwhen using keyword new to initialize a class function, the owner of this function is the newly
阅读全文
posted @ 2012-10-20 00:14
Jian, Li
摘要:JavaScript FunctionsNot like c#, less parameter(s) can be passed to a function, the omitted one(s) would be undefinedThere isn’t method overloading like c#, the latter definition simply makes the former one disappear.arguments object can be used within a function to check the parametersUsing the arg
阅读全文
posted @ 2012-10-19 04:51
Jian, Li
摘要:JavaScript BasicsSpecial number valuesNote:10/0 doesn’t throw exception, it returns NaN insteadNaN doesn’t equal to NaNuse isNaN function to test NaNisNaN will coalesce string of numberFlow-control statements apply coalescing to booleanIn logical expression, the following values will be treated as f
阅读全文
posted @ 2012-10-19 02:53
Jian, Li
摘要:Study (4) Custom Binding Handlers and Persisting DataCustom Binding HandlersDemo: Binding to jQuery button to change multiple attributesHere the binding handler turns the button to jQuery UI button and modifies the attributes of it by conditionRresult:Binding Handler with Behavior - starRating DemoA
阅读全文
posted @ 2012-10-17 04:57
Jian, Li
摘要:Study (3) Templates, Control of Flow, and Containerless BindingsNamed Templates in Script TagsEncapsulate a template for re-useDemo:run the code in jsFiddleActually we can use <div> or <ul>, instead of <script> tag to define a template like this:Control of FlowAnonymous-Inline Temp
阅读全文
posted @ 2012-10-13 01:30
Jian, Li
摘要:Study (2) Built In BindingsBinding - Text and HTMLTEXT renders the text itself, while HTML renders with html syntax:run the code in jsFiddleBinding - Checkbox and Radio ButtonFor Radio buttons, only if the value attribute equals to the data binding parameter “checked”, KO will set the radio button t
阅读全文
posted @ 2012-10-06 04:36
Jian, Li
只有注册用户登录后才能阅读该文。
posted @ 2012-10-06 02:56
Jian, Li
摘要:Study (1) Bindings and ObservablesUse jQuery to push data to DOM elements, without data bindingUse Knockout’s Observables to bind datadata.jsView Code var my = { }; //my namespacemy.sampleData = (function (my) { "use strict"; var data = { Products: [ { "ModelId": 1, ...
阅读全文
posted @ 2012-10-05 01:41
Jian, Li

浙公网安备 33010602011771号