初次接觸jade,並且本人只有一點點的html技術基礎,所以以下代碼僅供jade基本參考,不妥之處,還望大家指點一二。
doctype html
html(lang="en")
head
title marmot
script(src="javascripts/event.js")
//-其實我也不知道這個路徑正確與否,但是應該是這麼寫吧?event.js是放到public/javascripts下面的
body
h1 this is a test of jade & nodejs
div
h5 hello,this is sangoma,I apply the website for I thought I'm a primary programmer who makes much bug
-var user={name:'sangoma',isVIP:false}
//-從這個地方起到下面是練習if語句,注意var前面的-,然後我一開始定義name以及isVIP的時候把他們作爲字符串寫上了,即'name'、'isVIP',然後下面
//-調用user.isVIP的時候報錯說isVIP未定義
#container
- if (user.isVIP)
Get congratrulations,you are our VIP
- else
div
p
| there is no meanning to write this
div
| so why did you do this meaninglessly job
div
label(for="excel") 姓名
input(type="text", name="textName")
div
label(for="sex") 性別
input(type="email", name="mail",value="[email protected]")
//-這個地方有一個小坑,就是你使用提示去填的時候input後面會自動加#,記得刪掉,不然到#input就結束了然後就會提示
//-input is self closing and should not have content
input(type="button", value="測試數據取值",name='getButton')
input is self closing and should not have content.問題的處理詳見上,其他可能會導致這個問題的bug還沒有遇到,遇到在正文修改或者評論區補充。