javascript 页面跳转语句
javascript页面跳转常用代码
按钮式:
<INPUT name="pclog" type="button" value="GO" onClick="location.href='http://www.163.com'">
或者
<input type="button" value="重新购买" onclick="return goBack();"/>
<script language="javascript">
function goBack(){
history.go(-3);
}
</script>
链接式:
<a href="javascript:history.go(-1)">返回上一步</a> //-1可以根据情况指定;
<a href="<%=Request.ServerVariables("HTTP_REFERER")%>">返回上一步</a>
直接跳转式:
<script>window.location.href='http://www.163.com.cn';</script>
开新窗口:
<a href="javascript:" onClick="window.open('http://www.163.com','','height=500,width=611,scrollbars=yes,status=yes')">十分方便</a>
本文来自CSDN博客,转载请标明出处:http://blog.csdn.net/Peter_K/archive/2007/01/29/1497226.aspx
相关文档:
// 学习要想拷贝那么快就好了
//
// JavaScript 的继承是基于 prototype 的,每个对象的 prototype 是保存在对象的 __proto__ 属性中的,这个属性是内部(internal)的属性( 惯例是内部的或者隐藏的属性以 _ 开头)
// A prototype-based language has the notion of a prototypical object, an object used as a template ......
1.document.formName.item('itemname')的问题
说明:IE下可以使用document.formName.item('itemname')和document.formName.elements('elementsName');
FF下只能使用docuement.formName.elements('elementsName');
解决方法:统一使用docuement.formName.elements('elementsName');
2.集合类对象问题
说明:IE下可以使用[]和 ......
单体模式(singleton)
单体是在脚本加载时创建的,能将一系列有关联的变量和方法组织为一个逻辑单元,逻辑单元里面的内容通过单一的变量进行访问;
一个单体主要分为三部分
用于访问内部信息的入口变量(如:Sky)
属性(如:nickName/age/timeInfo)
方法(如:sayHello)
基本结构
01
var Sky = {
02
& ......
with(document)
{
write ("test");
write
("dsasfda");
}
上面是用了with
如果不用的话就要这样写了
document.write (" ......
js eval
eval函数接收一个参数s,如果s不是字符串,则直接返回s。否则执行s语句。如果s语句执行结果是一个值,则返回此值,否则返回undefined。
例子
直接运算
alert(eval('1+2')); // ->3
赋值
eval('var aa = 5');
alert(aa); // ->5
类型转换
var yy = "{a:'aa',b:'bb'}";
yy = eval('(' + yy + ')');
......