JavaScript实现页面跳转的几种方式
1. 按钮式:
<INPUT name="pclog" type="button" value="GO" onClick="location.href='http://xxxx.cn/'">
2. 链接式:
<a href="javascript:history.go(-1)">返回上一步</a>
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
3. 直接跳转式:
<script>window.location.href='http://www.xxxx.cn';</script>
4.开新窗口:
<a href="javascript:" onClick="window.open('http://www.xxxx.html','','height=500,width=611,scrollbars=yes,status=yes')">奉天承运</a>
5. 自动跳转:
<html>
<head>
<title>newpaeg</title>
</head>
<script language='Javascript'>
function go(){
window.location="http://www.sohu.com"; //跳转到http://www.sohu.com页面,转至同一目录还是其它网页看你给的地址了
}
setTimeout("go()",5000);
/5秒钟后执行go()
}
</script>
<body>
</body>
</html>
相关文档:
<html>
<head>
<title>test javaScript</title>
//css设置图像的透明度
<mce:style><!--
img
{
filter:alpha(opacity=10)
}
--></mce:style><style mce_bogus="1">img
{
filter:alpha(opacity=10)
}</style>
<mce:script type="text/javasc ......
用Javascript取float型小数点后两位,例22.127456取成22.13,如何做?
1. 最笨的办法....... [我就怎么干的.........]
1function get()
2{
3 var s = 22.127456 + "";
4 var str = s.substring(0,s.indexOf(".") + ......
页面内嵌不同的网页内容时,导致iframe的高度无法与实现内容或浏览器高度相匹配。窗口大小变换时,不能iframe不能进行自动调整。这里,我们利用JAVASCRIPT让IFRAME框架的高度自适应。
首先,写出如下的JS方法。
/**
* 内嵌页面的高度设置
*/
function handleFrameLoad() {
var hDoc = getBodyHeight(document);
var ......
常用的JavaScript验证正则表达式
下面都是我收集的一些比较常用的正则表达式,因为平常可能在表单验证的时候,用到的比较多。特发出来,让各位朋友共同使用。呵呵。
匹配中文字符的正则表达式: [u4e00-u9fa5]
评注:匹配中文还真是个头疼的事,有了这个表达式就好办了
匹配双字节字符(包括汉字在内):[^x00-xff]
评注 ......
网页可见区域宽: document.body.clientWidth
网页可见区域高: document.body.clientHeight
网页可见区域宽: document.body.offsetWidth (包括边线的宽)
网页可见区域高: document.body.offsetHeight (包括边线的高)
网页正文全文宽: document.body.scrollWidth
网页正文全文高: document.body.scrollHeight ......