❶ 怎么过滤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获取详细指导。