跳到主要內容

發表文章

目前顯示的是有「Html」標籤的文章

對html網站移除.html副檔名 (Remove .html extension from URLs using url rewrite in IIS 8 for html website)

在Web.config中加入下列的rewrite URL設定即可 [rewrite] [rules] [rule name="Hide .html ext"] [match ignorecase="true" url="^(.*)"] [conditions] [add input="{REQUEST_FILENAME}" matchtype="IsFile" negate="true"] [add input="{REQUEST_FILENAME}" matchtype="IsDirectory" negate="true"] [add input="{REQUEST_FILENAME}.html" matchtype="IsFile"] [/add][/add][/add][/conditions] [action type="Rewrite" url="{R:0}.html"] [/action][/match][/rule] [rule name="Redirecting .html ext" stopprocessing="true"] [match url="^(.*).html"] [conditions logicalgrouping="MatchAny"] [add input="{URL}" pattern="(.*).html"] [/add][/conditions] [action type="Redirect" url="{R:1}"] [/action][/match][/rule] [/rules] [/rewrite] 參...

Regex

Password (UpperCase, LowerCase and Number) pattern : ^(?=.*\d)(?=.*[a-z])(?=.*[A-Z])(?!.*\s).*$ Password (UpperCase, LowerCase, Number/SpecialChar and min 8 Chars) (?=^.{8,}$)((?=.*\d)|(?=.*\W+))(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$ Password (UpperCase, LowerCase, Number and min 8 Chars) (?=^.{8,}$)(?=.*\d)(?!.*\W+)(?![.\n])(?=.*[A-Z])(?=.*[a-z]).*$

[JQuery] set Select Default

                        var el = $('#SelectID'); // Select the relevant option, de-select any others el.val("Man").attr('selected', true).siblings('option').removeAttr('selected'); // jQM refresh el.selectmenu("refresh", true);

[CSS] Vertically align an image inside a div with responsive height 在DIV中圖片垂直置中

<style> .container { height: 300px; text-align: center; font: 0/0 a; background-color:#999; } .container:before { content: ' '; display: inline-block; vertical-align: middle; height: 100%; } #caseImage { display: inline-block; vertical-align: middle; font: 16px/1 Arial sans-serif; width:100%; } </style> <div class="container" > <img src="image.jpg" id="caseImage" style=" margin:auto; " /> </div>

[HTML] dl dt dd 實際用法

之前對於<dl><dt><dd> 不是很瞭解 都誤用成類似表格的功能 其實他們定義應該是這樣的 dl: Definition List 可由一或多個 dt (可配多個 dd)與 dd 的搭配組成。 dt: Definition Term dd: Definition Description   所以用法應該如這樣 <dl> <dt>車輛</dt> <dd>轎車</dd> <dd>公車</dd> <dt>狗</dt> <dd>哈士奇</dd> <dd></dd> </dl>  

[Web]GenQRCode Web service

QRickit API提供了一個簡單的在頁面產生QRCode圖檔的方式 使用上很簡單,只要把img的src指向QRickit的服務,並傳送要產生文字與參數即可。 方法如下 <img src="http://qrickit.com/api/qr? d=http://anyurl & addtext=Hello+World & txtcolor=442EFF & fgdcolor=76103C & bgdcolor=C0F912 & qrsize=150 & t=p & e=m "> 把其中的anyurl取代成你要的URL 就可以產生對應的QRcode 資料來源: QRickit QR Code API

[JQuery] jQuery Masonry

今天看到一個jQuery Masonry Plugin - 版型工具 發現會是一個在設計網站layout很有用的工具 從這張他們的說明圖 可以稍微瞭解一下用的Masonry這個plugin後的效果 有興趣的人可以再到他們官網瞭解更多 Masonry

[CSS] Div 置底

css style如下 <style type="text/css"> .footer { position:fixed !important; /*for ie*/ top:expression(document.body.clientHeight + offsetParent.scrollTop-this.offsetHeight-5); /*for ff*/ bottom:15px; right:15px; } </style> <div style="height: 120px;" id="footer" class="r1">Message</div>

[.NET] HTML Parser --HTML Agility Pack

HTML Agility Pack 提供了用XPath去分析 html的結構的功能 用於要抓網站資料的時候很有用 下面是用 HTML Agility Pack以Xpath的語法去抓yahoo股市資料的code Dim client As New WebClient() Dim sr As Stream = client.OpenRead("http://tw.stock.yahoo.com/q/q?s=2409") Dim doc As New HtmlAgilityPack.HtmlDocument() doc.Load(sr, System.Text.Encoding.GetEncoding("big5")) Dim nodes As HtmlAgilityPack.HtmlNodeCollection = doc.DocumentNode.SelectNodes("/html/body/center/table[2]/tr/td/table/tr[2]/td") If nodes IsNot Nothing Then For Each node As HtmlAgilityPack.HtmlNode In nodes Console.WriteLine(node.InnerText.Trim()) Next End If Console.ReadLine() Xpath 的語法 可以參考 XPath Tutorial sample on MSDN Download HTML Agility Pack