0
JS Help 2
How can I make a button when pressed make new buttons appear. (the new button are pre-made but invisible)
5 Réponses
+ 24
<html>
<head>
<title>JavaScript A-Z Practicals</title>
<style>
h1{
color:red;
text-align:center;
background:-webkit-linear-gradient(blue , cyan , #00F318 , cyan , blue);
}
button {
color:red;
font-weight:bolder;
padding:10px;
margin:10px 0 10px 30%;
}
pre{
color:#00F318;
}
</style>
<script>
function show_code() { x = document.getElementById("show_js_code");
if(x.style.display=="block"){
x.style.display="none";
}
else{
x.style.display="block";}
}
</script>
</head>
<body bgcolor="black">
<h1>If & Else</h1>
<button onclick="show_code()">Show Code</button>
<br/>
<pre id="show_js_code">
if( b_tags.style.display=="block"){
b_tags.style.display="none";
}
else{<br/> b_tags.style.display="block";}
</pre>
</html>
try this code 100% Working
+ 8
you can change the css with js
yourButton.style.display = "block";
yourButton.style.display = "none";
+ 6
<input type="button" value="click me" onclick="myFunction()" />
- 1
im asking how can i make a button appear