Script编程window对象以及this的用法
来源:互联网 发布:数控加工仿真软件 编辑:程序博客网 时间:2024/06/05 16:24
prompt对话框
<html><head><title>函数</title><Script language="JavaScript">var userName = prompt("请输入你的名字:"); document.write("你好!"+userName);</Script></head><body></body></html>
confirm对话框
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><script type="text/javascript">//while(true)///alert("ghahah");function confirmit(){var obj=document.getElementById("testa");if(confirm("你确认删除此文件么?")){obj.submit();} } </Script></head><body><form id="testa" action="ttt.jsp" method="post"><input type="button" value="删除文件" onclick="confirmit()" name="aaa"></form></body></html>
<html><head><title>函数</title><Script language="JavaScript">function confirmit(){ if(confirm("你确认删除此文件么?")) { document.testa.submit(); } } </Script></head><body><form name="testa" action="ttt.jsp" method="post"><input type="button" value="删除文件" onclick="confirmit()" name="aaa"></form></body></html>
this
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"><html xmlns="http://www.w3.org/1999/xhtml"><head><meta http-equiv="Content-Type" content="text/html; charset=gb2312" /><title>无标题文档</title><!--prompt提示comfirm认证submit提交status状态--><Script type="text/javascript">function checkit(obj){if(obj.value==""){alert("空值");}else{alert(obj.value);}}</Script></head><body><img src="1.jpg" onclick="alert(this.src);"><form ><input type="text" value="ddaaa" onclick="checkit(this)"></form></body></html>
///////////////////////////////////////
下面的很少用
window.status
鼠标经过的时候
<html><head><title>本地窗口</title></head><body onload="window.status='Hello,Please look here!'"><!--状态栏body的状态属性--><form name="ttt"><input type="button" value="test" onMouseOver="window.status='haha';"></form></body> </html>
new windiow
前面是位置,后面是大小
<html><head><title>新开窗口</title></head><body><Script language="JavaScript">window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=100,height=100,resizable=no");//window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=100,height=100,resizable=no");//window.open("1.htm");</Script></body></html>
focus()close()
<html><head><title>新开窗口</title></head><body><Script language="JavaScript">var abc = window.open("1.htm","newWin","toolbar=no,left=200,top=100,menubar=no,width=300,height=100");</Script><input type="button" onclick="JavaScript:abc.focus();" value="跑前面来"><input type="button" onclick="JavaScript:abc.close();" value="关闭"></body></html>
window.location
网页的位置
<html><head><title>本地窗口</title></head><body><Script language="JavaScript">//alert(window.location);alert(document.location.href);</Script></body></html>
<html><head><title>本地窗口</title></head><body><Script language="JavaScript">function go2(){ window.location="33.htm";}</Script><input type="button" value="转向" onclick="JavaScript:go2()"></body></html>
history.back();
<html><head><title>本地窗口</title></head><body><Script language="JavaScript">function goBack(){ history.back();}</Script><input type="button" value="返回" onclick="JavaScript:goBack()"></body></html>
- Script编程window对象以及this的用法
- Script的Window对象学习加深
- 面向对象编程基础 二 this的用法
- 关于script的dictionary对象的用法
- 关于script的dictionary对象的用法
- Java Script 的面向对象编程
- JAVASCRIPT编程 this的用法
- 黑马程序员 面向对象(上) 封住,继承,多态,以及this和super的用法
- JavaScript DOM编程基础精华02(window对象的属性,事件中的this,动态创建DOM,innerText和innerHTML)
- 对象的this以及构造方法
- window.showModalDialog 和 window.open的区别以及用法
- [Flex]Flex编程注意之直接获取某个组件的对象(this[]用法)
- [Flex]Flex编程注意之直接获取某个组件的对象(this[]用法)
- this用法以及详解
- JavaScript中几个特殊的对象:window对象、this对象、global对象
- JavaScript中几个特殊的对象:window对象、this对象、global对象
- window对象用法
- 理清浏览器Window对象&window对象&this对象
- 那年,那场青春繁华梦
- 关于游戏服务器设计的一些领悟
- Javascript typeof 用法
- JAVA--第七周实验--输出24个希腊字母与26个大写英文字母--运用类的继承
- g++(nvcc) 链接库文件
- Script编程window对象以及this的用法
- 怎么理解HTTP协议是无状态协议
- 查找----二维数组的查找之杨氏矩阵
- Android之动画ViewPager小结(QQ续三)
- 你若安好
- javascript 之 push方法
- 查看进程的线程数
- IT++的信号源真差劲
- JavaScript操作符instanceof揭秘