html ; css ; javascript ; json ;

來源:互聯網
上載者:User

標籤:表示   navigator   idt   word   select   學習   ota   eval   var   

[說明]今天因為看到了前端的js頁面和html頁面,覺得有必要熟悉一下他們的基本文法,所以花了一天的時間去複習鞏固了一下(之前學習過),包括html文法,css文法,javascript文法,對象、BOM(瀏覽器物件模型),json(javascript 對象標記法) PS:瞭解的只是基本用法,大概能看到簡單的語句,達不到實用的程度。

一:今日完成

1)HTML

標籤,元素和屬性

標題 段落 粗體 斜體 刪除效果 底線 

各種框框和按鈕

2)CSS

css的文法 
selector {property: value} 
即 選取器{屬性:值} 
學習css即學些有哪些選取器,哪些屬性以及可以使用什麼樣的值

各種布局(頭暈)

3)JAVASCRIPT

JavaScript用於網頁和使用者之間的互動,比如提交的時候,進行使用者名稱是否為空白的判斷。

完整的javascript由語言基礎,BOM和DOM組成。

五種基本對象和自訂對象

4)BOM

BOM即 瀏覽器物件模型(Brower Object Model)

瀏覽器對象包括
Window(視窗)
Navigator(瀏覽器)
Screen (用戶端螢幕)
History(訪問曆史)
Location(瀏覽器地址)

5)JSON

JSON JavaScript 物件標記法(JavaScript Object Notation) 是一種儲存資料的方式。

 建立JSON對象
 訪問JSON對象

 建立JSON數組
訪問JSON數組

 JSON對象與JavaScript對象
 字串轉為JSON對象

二;明日計劃

明天再稍微瞭解一下  AJAX,JQuery  ,  BootStrap(真的只是瞭解)

三:疑難問題

因為前端語言都是所見即所得 (WYSIWYG),對著網上的教程很少出問題,,

四:思考總結

看到js的文法時候發現和java是有一點點相似的地方的,,

< script > function p(s){    document.write(s);    document.write("< br >"); }  p("協議 location.protocol:"+location.protocol); p("主機名稱 location.hostname:"+location.hostname); p("連接埠號碼 (預設是80,沒有即表示80連接埠)location.port:"+location.port);  p("主機加連接埠號碼 location.host:"+location.host); p("訪問的路徑  location.pathname:"+location.pathname);  p("錨點 location.hash:"+location.hash); p("參數列表 location.search"+location.search);  </ script > < script >  var s1 = "{\"name\":\"蓋倫\""; var s2 = ",\"hp\":616}"; var s3 = s1+s2;  document.write("這是一個JSON格式的字串:" + s3); document.write("< br >"); var gareen = eval("("+s3+")");  document.write("這是一個JSON對象: " + gareen);    </ script > < html > 使用者名稱 < input name = "userName" > < br > 密碼  < input name = "userPassword" > < br > < script > var  elements= document.getElementsByName("userName");    for(i=0;i< elements.length ;i++){    document.write(elements[i]);    document.write("<br>"); }    </ script > </ html >getElementsByName,通過標籤屬性值得到標籤,這個不用瞭解嗎?有這個用法,但是並不建議在工作的時候用到。
因為他即不能像getElementById這樣定位一個唯一的
也不能像getElementsByClassName這樣擷取 預先被分類在一起的元素。
進一步講解,name屬性用於被提交到服務端,如果服務端代碼發生調整,name需要跟著調整,相應的getElementsByName也需要進行同步改動才能保證正常運行,這就加大了維護成本和出錯的幾率。
而getElementById和getElementsByClassName 中的id和class只會出現在前端頁面,和後端無關,相比較而言,沒有潛在的維護成本的增加。nodeType表示一個節點的類型所對應的值‘,要不然很容易和”節點值(nodeValue)“概念混淆

html ; css ; javascript ; json ;

相關文章

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.