发布于 2017-07-02 07:56:13 | 153 次阅读 | 评论: 0 | 来源: 网友投递

这里有新鲜出炉的Javascript教程,程序狗速度看过来!

JavaScript客户端脚本语言

Javascript 是一种由Netscape的LiveScript发展而来的原型化继承的基于对象的动态类型的区分大小写的客户端脚本语言,主要目的是为了解决服务器端语言,比如Perl,遗留的速度问题,为客户提供更流畅的浏览效果。


js 点击按钮弹出另一页,选择值后,返回到当前页,其实主要用于cms系统中,相关文章的搜索,要在已上传目录中选择一些图片等。
1。 效果图:

2。 主页面的代码:
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<head runat="server"> 
<title></title> 
<script type="text/javascript"> 
function open_windows_and_get_selectedinfo(openwindow, control, control2) { 
var str = window.showModalDialog(openwindow, window, "dialogWidth=740px;dialogHeight=600px;center=yes;help=no;resizable=no;status=no"); 
if (!str) 
return; 
document.getElementById(control).value = str[0]; 
document.getElementById(control2).value = str[1]; 
} 

</script> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div id="autosuggest" style="width:160px;font-size:12px;"><ul></ul></div> 
<div> 
<input id="txtActive" runat="server" readonly="readonly" /> 
<input type="button" id="selectActive" runat="server" onclick="javascript:open_windows_and_get_selectedinfo('TestEdt.aspx','hfActive','txtActive')" value="..." /> 
<asp:HiddenField ID="hfActive" runat="server" /> 
</div> 
</form> 
</body> 
</html> 

3。 弹出页面的代码:
 
<html xmlns="http://www.w3.org/1999/xhtml"> 
<base target="_self"> 
<head runat="server"> 
<title></title> 
<script type="text/javascript" language="javascript"> 
function dbclick_return_and_close(strid, strvalue) { 
alert("执行该方法!"); 
var str = new Array(strid, strvalue); 

window.returnValue = str; 
window.close(); 
} 
</script> 
</head> 
<body> 
<form id="form1" runat="server"> 
<div> 
<a href="#" onclick="javascript:dbclick_return_and_close( '1', 'aaaaaaa');">点击这一行,带值返回到原页面</a> 
</div> 
</form> 
</body> 
</html> 


最新网友评论  共有(0)条评论 发布评论 返回顶部

Copyright © 2007-2017 PHPERZ.COM All Rights Reserved   冀ICP备14009818号  版权声明  广告服务