tio777
06-30-2013, 03:17 AM
I have been trying to get a button working on my webpage.
Here is what I have so far...
<head>
<style>
#container{
display: block;
position: absolute;
height: 61px;
width: 373px;
margin-left: auto;
margin-right: auto;
margin-top: auto;
}
.customButton{
display: block;
position: absolute;
height: 100%;
width: 100%;
}
#myButton1{
background-image:url('http://imageurl.com/PDownloadAllFiles1.png');
}
#myButton2{
background-image:url('http://imageurl.com/PDownloadAllFiles2.png');
opacity:0;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
#myButton2:hover{
opacity: 1;
}
#myButton3{
visibility: hidden;
background-image:url('http://imageurl.com/downloading.gif');
}
</style>
<script>
function onContainerClick(){
document.getElementById('myButton3').style.visibility='visible';
}
</script>
</head>
<body>
<div id='container' onclick='onContainerClick();'>
<div id='myButton1' class='customButton'></div>
<div id='myButton2' class='customButton'></div>
<div id='myButton3' class='customButton'></div>
</div>
</body>
</html>
Where I'm having trouble is that when I click on the "myButton2" div I want an href that will download a file. I can do this by adding my href to the div code there. Only when it is downloading the file I also want it to turn into myButton3 as well. So if I add the href in the div I can't have it turn into myButton3.
Help!
Here is what I have so far...
<head>
<style>
#container{
display: block;
position: absolute;
height: 61px;
width: 373px;
margin-left: auto;
margin-right: auto;
margin-top: auto;
}
.customButton{
display: block;
position: absolute;
height: 100%;
width: 100%;
}
#myButton1{
background-image:url('http://imageurl.com/PDownloadAllFiles1.png');
}
#myButton2{
background-image:url('http://imageurl.com/PDownloadAllFiles2.png');
opacity:0;
-webkit-transition: opacity 0.5s ease-in-out;
-moz-transition: opacity 0.5s ease-in-out;
-o-transition: opacity 0.5s ease-in-out;
transition: opacity 0.5s ease-in-out;
}
#myButton2:hover{
opacity: 1;
}
#myButton3{
visibility: hidden;
background-image:url('http://imageurl.com/downloading.gif');
}
</style>
<script>
function onContainerClick(){
document.getElementById('myButton3').style.visibility='visible';
}
</script>
</head>
<body>
<div id='container' onclick='onContainerClick();'>
<div id='myButton1' class='customButton'></div>
<div id='myButton2' class='customButton'></div>
<div id='myButton3' class='customButton'></div>
</div>
</body>
</html>
Where I'm having trouble is that when I click on the "myButton2" div I want an href that will download a file. I can do this by adding my href to the div code there. Only when it is downloading the file I also want it to turn into myButton3 as well. So if I add the href in the div I can't have it turn into myButton3.
Help!