我有这三个函数,该怎么做呢在onload时一个接一个地调用它们在refresh时一次调用一个函数
I have these three function, what to do call them on onload one by one on refresh one function call at a time
我有三个函数的弹出。我想让它们一个接一个地在onload/refresh
上调用在刷新弹出改变告诉我的解决方案,我可以使用这个过程中每次刷新函数调用。但是每次一个刷新下一个。我尝试使用数组和随机标记,但未能运行此。
<html>
<head>
<title>four popup ads js used</title>
<link type="text/css" rel="stylesheet" href="popup.css">
<script src="jquery-1.2.6.min.js" type="text/javascript"></script>
<script src="popup.js" type="text/javascript"></script>
<script type="text/javascript">
// Bottom Popup JS//
$(document).ready(function () {
// When site loaded, load the Popupbox First
loadPopupBox();
$('#popupBoxClose').click(function () {
unloadPopupBox();
});
$('#container').click(function () {
unloadPopupBox();
});
function unloadPopupBox() { // TO Unload the Popupbox
$('#popup_box').fadeOut("slow");
$("#container").css({ // this is just for style
"opacity": "1"
});
}
function loadPopupBox() { // To Load the Popupbox
$('#popup_box').fadeIn("slow");
$("#container").css({ // this is just for style
"opacity": "0.6"
});
}
});
// Transparent popup JS//
$(document).ready(function () {
$("p").click(function () {
$("#div1").fadeOut();
});
});
// onclick popup Under//
var win = null;
function NewWindow(mypage, myname, w, h, scroll, pos) {
if (pos == "random") {
LeftPosition = (screen.width) ? Math.floor(Math.random() * (screen.width - w)) : 100; TopPosition = (screen.height) ? Math.floor(Math.random() * ((screen.height - h) - 75)) : 100;
}
if (pos == "center") {
LeftPosition = (screen.width) ? (screen.width - w) / 2 : 100; TopPosition = (screen.height) ? (screen.height - h) / 2 : 100;
}
else if ((pos != "center" && pos != "random") || pos == null) { LeftPosition = 0; TopPosition = 20 }
settings = 'width=' + w + ',height=' + h + ',top=' + TopPosition + ',left=' + LeftPosition + ',scrollbars=' + scroll + ',location=yes,directories=yes,status=yes,menubar=yes,toolbar=yes,resizable=yes';
win = window.open(mypage, myname, settings);
}
</script>
</head>
<body>
<div id="div1" style="background-color:gray;height:650px;width:81%;position:relative;">
<div id="popup_box">
<div class="small_box">You May Like This <img src="close.jpeg" id="popupBoxClose" height=20 width=15></div>
<div>
<br>
<div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-1.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>Just click on it</span></a></div>
<div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-2.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>just click on it </span></a></div>
<div style="float:left;border-right: 2px solid gray;"><a href=""><img src="slider-2.jpg" height=63><span style="float:right;"><br>IT's Only for U <br>Just click on it </span></a></div>
<div style="float:left;"><a href=""><img src="slider-3.jpg" height=63><span style="float:right"><br>IT's Only for U <br>Just click on it</span></a></div>
</div>
</div>
</div>
</body>
</html>
我只想在刷新时逐一调用该页面的所有函数
可以这样使用。
HTML页面<!doctype html>
<html lang="en">
<head>
<meta charset="utf-8">
<title>jQuery UI Dialog - Default functionality</title>
<link rel="stylesheet" href="//code.jquery.com/ui/1.11.0/themes/smoothness/jquery-ui.css">
<script src="//code.jquery.com/jquery-1.10.2.js"></script>
<script src="//code.jquery.com/ui/1.11.0/jquery-ui.js"></script>
<link rel="stylesheet" href="StyleSheet.css">
</head>
<body>
<h4>Test Loaded</h4>
<div id="dialogA" class="box" title="Basic dialog">
<h1>dialogA</h1>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<div id="dialogB" class="box" title="Basic dialog">
<h1>dialogB</h1>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<div id="dialogC" class="box" title="Basic dialog">
<h1>dialogC</h1>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<div id="dialogD" class="box" title="Basic dialog">
<h1>dialogD</h1>
<p>This is the default dialog which is useful for displaying information. The dialog window can be moved, resized and closed with the 'x' icon.</p>
</div>
<script src="JavaScript.js" type="text/javascript"></script>
</body>
</html>
CSS文件 StyleSheet.css
#dialogA, #dialogB, #dialogC, #dialogD {
/*display: none;*/
}
.box {
display: none;
}
JavaScript File JavaScript.js
var textToShow = ['#dialogA', '#dialogB', '#dialogC', '#dialogD']; //add the div ID as an array
var resultID = textToShow[Math.floor(Math.random() * textToShow.length)]; //get the random Id from the array
//alert(resultID);//Debug the Div ID
loadPopup(resultID);//Pass the ID to the function
function loadPopup(resultID) {
switch(resultID) {
case '#dialogA':
//alert('#dialogA');//Debuging
$(resultID).dialog({ height: '100px', width: '20px' });//custom width and height
break;
case '#dialogB':
//alert('#dialogB');//Debuging
$(resultID).dialog({ height: '200px', width: '120px' });//custom width and height
break;
case '#dialogC':
//alert('#dialogC');//Debuging
$(resultID).dialog({ height: '300px', width: '220px' });//custom width and height
break;
case '#dialogD':
//alert('#dialogD');//Debuging
$(resultID).dialog({ height: '400px', width: '320px' });//custom width and height
break;
default:
//alert('default');//Debuging
$(resultID).dialog();//Default width and height will be reffer
}
}
如果你需要我的帮助。
yeshansachithak
为我找到任何一个社交网络。
相关文章:
- 我可以在json对象中添加一个函数吗
- 如何在JQuery函数中定义一个值,然后调用另一个函数并使用该值
- 是否可以将一个函数输入连接到另一个函数调用的文本
- 在另一个函数中使用变量this
- 在另一个函数成功结束后调用该函数
- mongoose.connect undefined不是一个函数
- 监听器必须是一个函数
- 使用JS函数来使用另一个函数的语法?node.js
- 如何取消object.prototypes javascript的一个函数
- 从Chrome扩展名中的popup.html文件在background.js文件中运行一个函数
- 嵌套到另一个函数中的Fancybox函数;不起作用
- 如何在javascript中使用不止一个函数
- jQuery-在页面加载时执行一个函数
- jquery UI draggable:UI.children不是一个函数
- jQuery Mobile Undefined不是一个函数
- 如何在php中创建一个函数,该函数与文本区域一起工作,通过输入类似[color:red]的内容来打印具有等效颜色的文本
- javascript函数将数据添加到屏幕,但随后被另一个函数覆盖
- JS异常:animate不是一个函数
- 如何将一个函数附加到一个不存在的元素上
- JavaScript/jQuery-添加添加和删除类与下一个函数之间的延迟