嘿伙计们抱歉这个问题,我需要帮助在开始时通过javascript阻止下一个和前进按钮被阻止,当我点击Read Manga按钮时,我希望它显示后退和前进按钮。
严格要求javascript而不是jQuery。
function hide()
{
document.getElementById("listm").style.display = "none";
}
function showlist()
{
document.getElementById("listm").style.display = "block";
}
function fimage()
{
document.getElementById("bimages").style.display = "hidden";
}
function pimage()
{
document.getElementById("bimages").style.display = "hidden"
}
<button onclick = "hide()">Read Manga</button>
<button onclick = "showlist()">Show List</button>
<button id = "bimages" onclick = "pimages()";>Back</button>
<button id = "bimages" onclick = "fimages();">Forward</button>
<script>
mangaimage = document.getElementById("mangaim");
mangasummary = document.getElementById("ms");
readmanga = document.getElementById("rm");
aimages = document.getElementById("bimages");
</script>
</body>
答案 0 :(得分:1)
visible
不是display
属性(http://www.w3schools.com/cssref/pr_class_display.asp)的有效值,可以这样做:
document.getElementById("listm").style.display = "block";
或者这个:
document.getElementById("listm").style.visibility = "visible";
取决于您用来隐藏元素的CSS
编辑:
要在页面加载时隐藏下一个和上一个按钮,请执行以下操作:
<html>
<head>
<!-- your other head elements here -->
<style>
#next, #prev {
display: none;
}
</style>
</head>
<body>
<button onclick = "hide()">Read Manga</button>
<button onclick = "showlist()">Show List</button>
<button id = "next" onclick = "pimages()";>Back</button>
<button id = "prev" onclick = "fimages();">Forward</button>
<script>
//your code here
</script>
</body>
</html>
要使用javascript隐藏页面加载时的下一个和上一个按钮,请执行以下操作:
window.addEventListener('load', function(){
document.getElementById("next").style.display = "none";
document.getElementById("prev").style.display = "none";
}, false);
我真的不建议使用javascript,但最好将文体保存在CSS中。