❶ 怎麼過濾html標簽
過濾html標簽代碼如下:
public string checkStr(string html)
{
System.Text.RegularExpressions.Regex regex1 = new System.Text.RegularExpressions.Regex(@"<script[\s\S]+</script *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex2 = new System.Text.RegularExpressions.Regex(@" href *= *[\s\S]*script *:", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex3 = new System.Text.RegularExpressions.Regex(@" on[\s\S]*=", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex4 = new System.Text.RegularExpressions.Regex(@"<iframe[\s\S]+</iframe *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex5 = new System.Text.RegularExpressions.Regex(@"<frameset[\s\S]+</frameset *>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex6 = new System.Text.RegularExpressions.Regex(@"\<img[^\>]+\>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex7 = new System.Text.RegularExpressions.Regex(@"</p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex8 = new System.Text.RegularExpressions.Regex(@"<p>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
System.Text.RegularExpressions.Regex regex9 = new System.Text.RegularExpressions.Regex(@"<[^>]*>", System.Text.RegularExpressions.RegexOptions.IgnoreCase);
html = regex1.Replace(html, ""); //過濾<script></script>標記
html = regex2.Replace(html, ""); //過濾href=javascript: (<A>) 屬性
html = regex3.Replace(html, " _disibledevent="); //過濾其它控制項的on...事件
html = regex4.Replace(html, ""); //過濾iframe
html = regex5.Replace(html, ""); //過濾frameset
html = regex6.Replace(html, ""); //過濾frameset
html = regex7.Replace(html, ""); //過濾frameset
html = regex8.Replace(html, ""); //過濾frameset
html = regex9.Replace(html, "");
html = html.Replace(" ", "");
html = html.Replace("</strong>", "");
html = html.Replace("<strong>", "");
return html;
}
❷ chrome的html5和搜索
那些個控制按鈕要程序本身支持才行。IE當然有啊,別的瀏覽器沒功夫做。。
右鍵搜索叫context search,有插件,不過用楓樹更好。
❸ html5自動模糊查找,用戶輸入文字,自動開始模糊查找顯示提示,具體見補充
網路這個下拉提示是和資料庫有很大關系的。
如果你切身考慮到用戶體驗的時候,你會發現通過點擊能夠找到相應的城市和通個點擊找到相應城市,其實後者是更能提高用戶體驗的(因為人的惰性);我建議你去找一個【省份城市區級三級選項】代碼,不需要你去修改,大神們都封裝好了,而且很完整。網上很多,你可以參考下;
純屬個人建議;
❹ html5搜索框是怎麼實現搜索功能的
搜索功能需要結合網站程序功能來實現,一般主流程序都有搜索功能的。
html5隻是一個界面的美觀,自身沒有搜索功能。
也可以使用網路等搜索引擎的站內搜索,配合html5顯示效果更佳。
❺ HTML5怎麼這個搜索框右邊的放大鏡怎麼加的
需要准備的材料分別有:電腦、瀏覽器、html編輯器。
1、首先,打開html編輯器,新建html文件,例如:index.html。
❻ 怎麼用html5+js+css實現如圖所示的搜索下拉框,謝謝
<divclass="searchModel">
<selectname=""id=""value="2">
<optionvalue="0">科室</option>
<optionvalue="1">疾病</option>
<optionvalue="2">醫院</option>
</select>
<inputtype="text"placeholder="請輸入搜索內容">
<button>搜索</button>
</div>
<style>
html,
body,
div,
input,
select,
button{
margin:0;
padding:0;
border:none;
outline:none;
}
.searchModel{
display:flex;
border:1pxsolidorange;
border-radius:4px;
overflow:hidden;
margin:20px;
height:44px;
}
.searchModelselect{
color:#fff;
background:orange;
padding:022px;
/*appearance:none;*/
/*-moz-appearance:none;*/
/*Firefox*/
/*-webkit-appearance:none;*/
/*Safari和Chrome*/
}
select::-ms-expand{display:none;}
.searchModelselectoption{
color:#333;
background:#fff;
}
.searchModelinput{
flex:1;
padding:010px;
}
.searchModelbutton{
width:44px;
color:#fff;
background:orange;
}
</style>
要改變下拉選項選中的樣式,就用div去模擬下拉框
js部分,button提交表單,或者是div模擬提交ajax
❼ HTML5搜索欄怎麼提示多條搜索記錄,急求
<form>
<inputtype="text"autocomplete="on">
</form>
❽ 如何做出淘寶搜索框的效果。就是搜索框有一欄初始值,當滑鼠移到搜索框准備輸入時即立即清零html5
這個可以用h5裡面表單的placeholder屬性解決。
例子:
<form>
<inputtype="text"placeholder="你的姓名..."name="lname">
<inputtype="password"placeholder="你的密碼..."name="pass">
<inputtype="submit"value="提交">
</form>
❾ 用HTML5做一個只有一個搜索框的網頁
實現的辦法多了去了,
1000設備的編號存在數組里,
通過js進行數組配對,
甚至直接通過一些Jquery插件來查找,
通過ASP,PHP,.NET進行更簡單了,編號資料庫,或者一些文件,直接讀取數據就出來的了,
HTML5隻是一個前端腳本,要進行這些操作,還是要通過JS或者其它腳本來實現,只是前端顯示方式用HTML5或者腳本調用了HTML5的一些API進行操作。
具體怎麼做,真心一兩句話說不清,,建議專業事找專業人做,如果你是打算進軍這行業的話,那建議看基礎先。
❿ 如何讓html5體驗更像app
Tip 1: 使用web storage代替cookie
cookie最大的缺陷是在每一次HTTP請求中都會攜帶所有符合規則的cookie數據,這會增加請求響應時間,特別是XHR請求。在HTML5中使用sessionStorage和localStorage代替cookie是更好的做法。
這另種方法可以將數據永久或者以session時間存儲在用戶本地,數據不會隨著HTTP請求傳遞,所以我們優先使用web storage,僅僅使用cookie作為替代方案。
// if localStorage is present, use that
if (('localStorage' in window) && window.localStorage !== null) {
// easy object property API
localStorage.wishlist = '["unicorn", "Narwhal", "deathbear"]';
} else {
// without sessionStorage we'll have to use a far-future cookie
// with document.cookie's awkward API
var date = new Date();
date.setTime(date.getTime() + (365 * 24 * 60 * 60 * 1000));
var expires = date.toGMTString();
var cookiestr = 'wishlist=["unicorn", "Narwhal", "deathbear"];' +
' expires=' + expires + '; path=/';
document.cookie = cookiestr;
}
Tip 2: 使用CSS Transition代替JavaScript動畫
CSS Transition能帶來更高的性能,更少的代碼,更容易維護和理解。
Tip 3: 使用客戶端資料庫代替伺服器請求
Web SQL Database和IndexedDB讓瀏覽器有了資料庫存儲能力。很多應用場景可以遷移到客戶端資料庫以減少伺服器的請求次數。
localStorage和sessionStorage在簡單數據存儲時比客戶端資料庫更快,可以用來實現一些簡單的狀態,進度保存。
當一個組件需要管理上百條數據(如好友列表),同時支持用戶搜索、過濾、排序時,客戶端資料庫存儲一份數據可以有效減少HTTP請求次數。查看Web SQL Database tutorial獲取詳細指導。
Tip 4: 使用JavaScript原生API
隨著更高版本JavaScript的普及,像Array prototype新增了很多API都可以在大多數瀏覽器中直接使用。例如:
// give me a new array of all values multiplied by 10
[5, 6, 7, 8, 900].map(function (value) {
return value * 10;
});
// [50, 60, 70, 80, 9000]
// create links to specs and drop them into #links.
var linksList = document.querySelector('#links');
var links = [];
['html5', 'css3', 'webgl'].forEach(function (value) {
links.push(value.link('http://google.com/search?btnI=1&q=' + value + ' spec'));
});
linksList.innerHTML = links.join('');
// return a new array of all mathematical constants under 2
[3.14, 2.718, 1.618].filter(function (number) {
return number < 2;
});
// you can also use these extras on other collections link nodeLists
[].forEach.call(document.querySelectorAll('section[data-bucket]'),
function (elem, i) {
localStorage['bucket' + i] = elem.getAttribute('data-bucket');
});
通常情況下這些原生方法比手動編寫循環要快:
for (var i = 0, len = arr.length; i < len; ++i) {
}
使用原生JSON.parse()比json2.js更加高效、安全。
原生的String.prototype.trim也是一個很好的例子,這些功能不是HTML5中的,也應該得到廣泛的應用。
Tip 5: 不僅僅為離線app使用cache manifest,在線網站網站也可以適當使用
後台管理系統這樣的站點使用緩存可以極大提高性能。
cache manifest比設置Expires有一些優勢:明確地聲明需要緩存的文件,瀏覽器可以進行優化,可能在你使用之前就已經提前下載到本地了。
可以將頁面基本結構看做模板,顯示的內容隨著數據變化,將可模板化的HTML結構通過cache.manifest進行緩存,從伺服器端獲取JSON數據之後更新內容。
查看application cache tutorial獲取詳細指導。