我希望在<div id="fadeout">
单击提交按钮时淡出,然后<div id="fadein">
淡入以替换以前的 div。一点运气都没有。
我已经尝试了几种方法,但就是想不通。
任何帮助表示赞赏
<html>
<title>Break Calculator</title>
<head>
<style>
body {
background: #0e415f;
min-width:55em;
max-width:200em;
font-family: Omnes, Myriad Pro, arial, Helvetica;
color: #f1a400;}
.salary_div {
width: 12em;
margin: 0 auto;}
.salary_input{
width: 6em;
height: 1.2em;
font-size: 2em;}
.submit_div {
width: 8em;
margin: 1em auto;}
.header {
width: 55em;
margin: 0 auto;}
.clock {
border: .1em solid #f1a400 double;
border-radius: .1em;
border-style: double;
width: 3.5em;
margin: 20 auto;
font-size: 10em;
text-align:center;}
.money {
border: .1em solid #f1a400 double;
border-radius: .1em;
border-style: double;
width: 3.5em;
margin: 20 auto;
font-size: 10em;
text-align:center;}
.buttons {
width: 24.5em;
margin: 1em auto;}
.button_style{
height:2.5em;
width:6em;
font-size:1.2em;
margin: 0 .3em;
background: #f1a400;
border-radius: .4em;
border: 0;}
</style>
<script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>
<script type="text/javascript">
var salary;
var seconds=-1.0; /* To start clock at 0 seconds */
var min=0;
var time;
var secPay;
var timerPay = 0;
function getSalary() {
var salaryAm = document.getElementById("salaries");
salary = salaryAm.value;
secPay = salary/(52*40*60*60); // Weeks * Hours * Minutes * Seconds *//
}
function timer(){
seconds++;
if(seconds>59){
min++;
document.getElementById("mins").innerHTML=padTimer(min);
seconds=0;}
document.getElementById("secs").innerHTML=padTimer(seconds);
document.getElementById("money").innerHTML=parseFloat(secPay*timerPay++).toFixed(2);
};
function padTimer(x) {
if (x<=9) { x = ("0"+x); }
return x;}
function start(){
if (getSalary()) {
alert("please check input");
} else {
time=setInterval(timer, 1000);
timer();}
};
function pause() {
clearInterval(time);
seconds--;
timerPay--;};
function reset(){
seconds=-1.0;
timerPay=0;
time=0;
if (min !=0){
min=0;}
};
</script>
</head>
<body>
<div class="header"><img src="breakcalc.png"></div>
<div id="fadeout">
<div class="salary_div">
<input id="salaries" type="text" class="salary_input">
</div>
<div class="submit_div">
<a id="submit"><button class="button_style">Submit</button></a>
</div>
</div>
<div id="fadein">
<div class="clock" id="slideout">
<span id="mins" >00</span>:<span id="secs">00</span>
</div>
<div class="money">
<span>$ </span><span id="money">0.00</span>
</div>
<div class="buttons">
<a href="#" id="button" onclick="start()" ondblclick="return false;"><button class="button_style">Start</button></a>
<a href="#" id="button" onclick="pause()"><button class="button_style">Stop</button></a>
<a href="#" id="button" onclick="reset()"><button class="button_style">Reset</button></a>
</div>
</div>
</body>
</html>