点击"弹出层";就弹出一个层,这时,还可以点击父窗口的页面..
现在我要点击"关闭我"来关闭弹出层,请问这个函数怎么写?
等着熟悉BOXY的牛人回答..
现在这个函数可以解决,但是点击了"关闭我",再点击"弹出层",就不再弹出层了.
案例中有这么一句:Boxy.get(this).hide();但是这传递的是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=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="boxy.css" type="text/css" />
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="jquery.boxy.js"></script>
<script type="text/javascript">
$(function(){
$(".boxy").boxy();
});
function closeBoxy()
{
$('.boxy-wrapper').hide();
}</script>
</head><body>
<a href="#foobar" title="弹出层" class="boxy">弹出层</a></p>
<div id="foobar" style="padding:15px; display:none; background-color:#cad5eb; font-size:2em; color:#000000; font-weight:bold;"><div style="width:600px;height:600px"><input name="aaa" />这是一段ID为foobar的div标签内的文字</div></div>
<a href="javascript:void(0)" onclick="closeBoxy()">关闭我</a>
</body>
</html>
现在我要点击"关闭我"来关闭弹出层,请问这个函数怎么写?
等着熟悉BOXY的牛人回答..
现在这个函数可以解决,但是点击了"关闭我",再点击"弹出层",就不再弹出层了.
案例中有这么一句:Boxy.get(this).hide();但是这传递的是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=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="boxy.css" type="text/css" />
<script type="text/javascript" src="jquery-1.2.6.pack.js"></script>
<script type="text/javascript" src="jquery.boxy.js"></script>
<script type="text/javascript">
$(function(){
$(".boxy").boxy();
});
function closeBoxy()
{
$('.boxy-wrapper').hide();
}</script>
</head><body>
<a href="#foobar" title="弹出层" class="boxy">弹出层</a></p>
<div id="foobar" style="padding:15px; display:none; background-color:#cad5eb; font-size:2em; color:#000000; font-weight:bold;"><div style="width:600px;height:600px"><input name="aaa" />这是一段ID为foobar的div标签内的文字</div></div>
<a href="javascript:void(0)" onclick="closeBoxy()">关闭我</a>
</body>
</html>
<!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=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="boxy.css" type="text/css" />
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.2/jquery.min.js"></script>
<script type="text/javascript" src="jquery.boxy.js"></script>
<script type="text/javascript">
var box;
$(function(){
box = new Boxy($("#foobar"), {show:false});
});
function openBoxy(){
box.show();
}
function closeBoxy()
{
box.hide();
}</script>
</head><body>
<a href="javascript:openBoxy();void(0);" title="弹出层">弹出层</a>
<a href="javascript:closeBoxy();void(0);">关闭我</a>
<div id="foobar" style="padding:15px; display:none; background-color:#cad5eb; font-size:2em; color:#000000; font-weight:bold;">
<div style="width:600px;height:300px">
<input name="aaa" />这是一段ID为foobar的div标签内的文字
</div>
</div>
</body>
</html>
是啊,要对层操作,必须知道那对象是哪一个,必须实例化吧..
追问一下,本人对JQUERY不是很了解.
$(function(){
$(".boxy").boxy();
});
这里的$(".boxy").boxy();是什么意思?做了什么操作?
是$(".boxy")这块东西执行了boxy这个构造函数吗?也就是说实例化了一个对象吗?
是啊,要对层操作,必须知道那对象是哪一个,必须实例化吧..
追问一下,本人对JQUERY不是很了解.
$(function(){
$(".boxy").boxy();
});
这里的$(".boxy").boxy();是什么意思?做了什么操作?
是$(".boxy")这块东西执行了boxy这个构造函数吗?也就是说实例化了一个对象吗?
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>无标题文档</title>
<link rel="stylesheet" href="boxy.css" type="text/css" />
<script type="text/javascript" src="jquery.js"></script>
<script type="text/javascript" src="jquery.boxy.js"></script>
<script type="text/javascript">
var box;
$(function(){
box = $(".boxy").boxy();
});
function closeBoxy()
{
box.hide();
}</script>
</head><body>
<a href="#foobar" title="弹出层" class="boxy">弹出层</a></p>
<div id="foobar" style="padding:15px; display:none; background-color:#cad5eb; font-size:2em; color:#000000; font-weight:bold;"><div style="width:600px;height:600px"><input name="aaa" />这是一段ID为foobar的div标签内的文字</div></div>
<a href="javascript:void(0)" onclick="closeBoxy()">关闭我</a>
</body>
</html>
结果是错了,当点击"关闭我"时,隐藏了<a href="#foobar" title="弹出层" class="boxy">弹出层</a>这一块了
而事实上你要对 foobar做处理
接分。