所以我有这个代码,它适用于我的表单提交按钮,但我想让它在我的链接按钮上工作
JavaScript的:
function showLoading() {
document.getElementById('loadingmsg').style.display = 'block';
document.getElementById('loadingover').style.display = 'block'; }
HTML / CSS:
<style type="text/css">
#loadingmsg {
color: black;
background: #fff;
padding: 10px;
position: fixed;
top: 50%;
left: 50%;
z-index: 100;
margin-right: -25%;
margin-bottom: -25%;
}
#loadingover {
background: black;
z-index: 99;
width: 100%;
height: 100%;
position: fixed;
top: 0;
left: 0;
-ms-filter: "progid:DXImageTransform.Microsoft.Alpha(Opacity=80)";
filter: alpha(opacity=80);
-moz-opacity: 0.8;
-khtml-opacity: 0.8;
opacity: 0.8;
}
</style>
<div id='loadingmsg' style='display: none;'>Redirecting, please wait...</div>
<div id='loadingover' style='display: none;'></div>
<form action='' method='post' onsubmit='refreshpage();showLoading();'>
<input name='refresh' type="image" src="images/Next-Page-Button.gif" height="60" width="173" border="0" value='Refresh'>
</form>
我想让它在这个按钮上工作
<li><a href="facebook.php"><img src="images/logos/facebooklikeicon.png" height="25" border="0" /> Earn Coins Facebook</a></li>
我怎样才能做到这一点?
答案 0 :(得分:0)
这样做:
<a href="facebook.php" onclick="return showLoading();"><img src="images/logos/facebooklikeicon.png" height="25" border="0" /> Earn Coins Facebook</a>