当前位置:编程学习 > 网站相关 >>

Web development notes

Using vs or adobe brackets edits html/css/js, using chrome debugs js, using fiddler analyses http request/response.
When using adobe brackets, if you edit a html file, and click "Live Preview" on the right-top corner as follows, it will show visual effect of that html in chrome, during editing the html, once you save that html, chrome will show visual effect realtimely.
     
Html is a container for css/js and also provide some simple style, css provide more complex style, js controls behavior.
When writing html, first arrange the layout, outside in, then fill the detailed content, for example, first <html></html>, then <head></head> <body></body>, then fill <head> section and <body> section, and so on. Using <div> to define section.
Using <link> tag imports dependent external css files and using <script> tag imports dependent external js files in <head> section.
Adding dependent external sources such as css files or js files at the top of html file in <head> section.
Using fiddler as follows, you can redirect accessing to some external web sites to your local page, usually it's useful for debug.
Response status code: 1xx(information,不), 2xx (ok,好), 3xx(redirect,转), 4xx(client error,客), 5xx(server error,服)
For js, usually use augmented implementation for function as follows (self execute), the advantage are: if you function has a calculator function, and third party also has a calculator function, the calculator will include all the functions both from yours and third party. In the following code, the calculator will finally have 5 functions. When calculator is loaded for the first time, it will pass "{}" as argument because window.calculator is null, for the second time and then on, it will pass "window.calculator" as argument. If you want to let other places outside that function to use the variables or functions, you must return those variables or functions as object.
[javascript] view plaincopy
 var calculator = (function (math) {  
   math.add = function (a, b) {  
      return a + b;  
   };  
  
   math.subtract = function (a, b) {  
      return a - b;  
   };  
  
   math.multiply = function (a, b) {  
      return a * b;  
   };  
  
   math.divide = function (a, b) {  
      return a / b;  
   };  
  
   return math;  
})(window.calculator || {});  
  
var calculator = (function (math) {  
   math.doubled = function (a, b) {  
      return (a + b) * 2;  
   };  
  
   return math;  
})(window.calculator || {});  
 
补充:Web开发 , 其他 ,
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,