由于工作中突然用到一个js,需要对指定的字符串进行正则替换,由于中间内容不固定,所以只能用正则来写,经过搜索整理,总结了一个示例如下:
var str="https://abc.com?xxxx&id=778";
str.replace(/h[......]
由于工作中突然用到一个js,需要对指定的字符串进行正则替换,由于中间内容不固定,所以只能用正则来写,经过搜索整理,总结了一个示例如下:
var str="https://abc.com?xxxx&id=778";
str.replace(/h[......]
第一种:
<script type="text/JavaScript" language="JavaScript">// <![CDATA[
window.location.href=&qu[......]
str="test";
str.indexOf(value:String, [startIndex:Number]); 查找字符串,类似的lastIndexOf为倒找字符串
str.substr(start, length); 截取字符串
参考来源:[……]
document.getElementById('gwt-uid-2').checked ="checked";[......]
Javascript刷新页面的几种方法:
history.go(0);
location.reload();
location=location;location.assign(location);document.execCommand('Refresh&ap[......]
盒子标签和属性对照 | |
---|---|
CSS语法(不区分大小写) | JavaScript语法(区分大小写) |
border | border |
border-bottom | borderBottom |
包括0的随机整数-0-10:Math.floor(Math.random()*10);
不包括0的随机整数-1-10:Math.floor(Math.random()*10+1);[……]