
function show(n)
{
$('.lightBox').css({
"width":"400px",
立即学习“Java免费学习笔记(深入)”;
"height":"180px"
});
$("#lightBox").css("display", "block"); //这个不知道是干嘛的,如果没用就删掉吧。
//$(".lightBox_wrap").css("display", "block"); //把这句去掉
$('#'+n).css({
"display":"block"; //这里加一句
"width":$('.lightBox').width(),
"height":$('.lightBox').height(),
"top": $(document).scrollTop()+$(window).height()/2-$('.lightBox_wrap').height()/2,
"left":($(window).width()-$('.lightBox').width())/2
});
}
function ShowDiv(show_div,bg_div){
document.getElementById(show_div).style.display='block';
document.getElementById(bg_div).style.display='block' ;
var bgdiv = document.getElementById(bg_div);
bgdiv.style.width = document.body.scrollWidth;
// bgdiv.style.height = $(document).height();
$("#"+bg_div).height($(document).height());
$("#"+bg_div).append("canshu");
};一种是你在函数上给个参数 function ShowDiv(show_div,bg_div,"canshu"){}
一种是用js在某个特定的位置上获取到这个值 比如说 在 获取alt 属性就行了
在你的函数中将 $("#MyDiv").append("你的参数加上");就可以了
给按钮添加一个点击事件,填出一个层,宽高都为100%;
这样就实现了,点击按钮弹出一个层。
以上就是如何调用javascript中赋值的函数的详细内容,更多请关注php中文网其它相关文章!
java怎么学习?java怎么入门?java在哪学?java怎么学才快?不用担心,这里为大家提供了java速学教程(入门到精通),有需要的小伙伴保存下载就能学习啦!
Copyright 2014-2025 https://www.php.cn/ All Rights Reserved | php.cn | 湘ICP备2023035733号