PDA

View Full Version : changing display style for div's



angrymasteryoda
01-24-2012, 10:41 PM
i am having an issue with displaying a div after the user has clicked on 4 vote buttons. so what i want to happen is after the user click all 4 buttons a div#novote appears telling the user that there are no more votes that he can do today. heres the code i have so have

script section

<script type="text/javascript">
var votecount = 0;
function vote()
{
window.open("http://burlywood.forumsmotion.com/h12-v3frame");
votecount++;
}
function vote2()
{
window.open("http://burlywood.forumsmotion.com/h11-v2frame");
votecount++;
}
function vote3()
{
window.open("http://burlywood.forumsmotion.com/h9-v1frame");
votecount++;
}
function vote4()
{
window.open("http://burlywood.forumsmotion.com/h17-v4frame");
votecount++;
}

var ele = document.getElementById("novote");
if(votecount == 4) {
ele.style.display = "block";

}
else {
ele.style.display = "none";

}

</script>


html parts


<div id='vote1'>
<input type="button" value="Vote #1" onclick="vote(); toggle();" />
</div>
<div id='vote2'>
<input type="button" value="Vote #2" onclick="vote2(); toggle2();" />
</div>
<div id='vote3'>
<input type="button" value="Vote #3" onclick="vote3(); toggle3();" />
</div>
<div id='vote4'>
<input type="button" value="Vote #4" onclick="vote4(); toggle4();" />
</div>
<div id='novote' style='display:none;'>
<p>No more votes at this time come back later</p>
</div>


if you need to know what the toggle function is here is the code for that


function toggle() {
var ele = document.getElementById("vote1");
if(ele.style.display == "none") {
ele.style.display = "block";

}
else {
ele.style.display = "none";

}
}