Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <button onClick="div1()">Try it</button>
- <button onClick="div2()">Try it</button>
- <button onClick="div3()">Try it</button>
- <script>
- function div1() {
- var x = document.getElementById('myDIV');
- if (x.style.display === 'none') {
- x.style.display = 'block';
- } else {
- x.style.display = 'none';
- }
- }
- function div2() {
- var x = document.getElementById('myDIV2');
- if (x.style.display === 'none') {
- x.style.display = 'block';
- } else {
- x.style.display = 'none';
- }
- }
- function div3() {
- var x = document.getElementById('myDIV3');
- if (x.style.display === 'none') {
- x.style.display = 'block';
- } else {
- x.style.display = 'none';
- }
- }
- </script>
- <div id="rightSideDiv" ></div>
- <input type="hidden" id="myHiddenField1" value="<b> Info of div 1</b>" />
- <input type="hidden" id="myHiddenField2" value="<b> Info of div 2</b>" />
- <input type="hidden" id="myHiddenField3" value="<b> Info of div 3</b>" />
- <button onClick="doDisplay('myHiddenField1')">Try it</button>
- <button onClick="doDisplay('myHiddenField2')">Try it</button>
- <button onClick="doDisplay('myHiddenField3')">Try it</button>
- <script>
- function doDisplay(hiddenFileldID) {
- var x = document.getElementById(hiddenFileldID).value;
- document.getElementById("rightSideDiv").innerHTML = x;
- }
- </script>
Add Comment
Please, Sign In to add comment