發表文章

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

HTML 顯示特殊字元與符號編碼

HTML為了要顯示特殊字元,而非解析成保留字或標籤,如 陳大德<youraccount@yourmail.com>,會無法顯示正確,故要用特殊符號替代或是利用PHP內有htmlentities() 函數轉換。w3c shcool列舉很多,筆者僅列出常用的: #---------               name                number           其他方式 留空白                  &nbsp;                &#160             <pre> </pre> <                            &gt;                     &#60 >        ...

幾種網頁跳轉方式

1. 在<html><head>...</head></html>內加入<meta> <meta http-equiv="refresh" content="1;url="http://3ctipsmemo.blogspot.tw" /> content 為指定要經過幾秒跳轉,並跳轉到何url網址 2. 在<html>...</html> 內加入 javascript程式碼 <script>setTimeout(function(){document.location.href= http://3ctipsmemo.blogspot.tw},1000)</script> 用setTimeout 指定暫停幾毫秒後跳轉location.href至網址 自動更新頁面方法 parent.FrameID.location.reload()  /* 若有 frame 設定並指定 frame id */ window.opener.location.reload() /* 在子視窗更新上層父視窗頁面 */ 或利用 history history.go(0) 或更改document URL環境變數值指定為現在頁面,形成更新 document.URL=location.href 以上皆需包裹在<script></script> 標籤內 3. PHP 利用 header 需設定於<html>...</html>之外 <?php   header("refresh:1;url:http://3ctipsmemo.blogspot.tw"); ?> 設定1秒後更新網頁至目標 url 參考 https://www.w3schools.com/jsref/met_win_settimeout.asp

限制網頁被iframe亂嵌入引用

#Apache 設定 Header always append X-Frame-Options SAMEORIGIN #HTML META <meta http-equiv="X-Frame-Options" content="deny">   <meta http-equiv="X-Frame-Options" content="SAMEORIGIN"> <meta http-equiv="X-Frame-Options" content="ALLOW-FROM https://myhost"> #Nginx 設定 location /{ add_header X-Frame-Options SAMEORIGIN }   #IIS <system.webServer> ... < httpProtocol > < customHeaders > < add name = " X-Frame-Options " value = " SAMEORIGIN " /> </ customHeaders > </ httpProtocol > ... </system.webServer>     #HAProxy rspadd X-Frame-Options:\ SAMEORIGIN   #PHP 方式 header('X-Frame-Options:Deny'); header('X-Frame-Options:SAMEORIGIN'); header('X-Frame-Options:ALLOW-FROM https://myhost ')     if($_server['http_host']!='localhost'){exit('iframe is spammed');} ...

HTML + CSS 修改按鈕 (Button) 參數屬性

一般HTML button可用以下標籤 <input type="button" value="mybutton" name="mybutton"> 透過 CSS 方法可支援以下 style 屬性 <input type="button" value="mybutton" name="mybutton" style="width:200px; height:200px;border:2px red double; background-color:#aabbcc; color:#cccccc; > /* width: 代表按鈕寬度 height: 代表按鈕高度 border: 代表按鈕框線,分別放 寬度,顏色,樣式。樣式可以給 dashed, double, none background-color: 代表按鈕背景顏色 color: 代表按鈕文字顏色 * /