I have two buttons set up as onclicks that use JS to connect to other pages that are internal to my website. These pages connected to only run php that is displayed in tables. This tanle data is then displayed in the iframe set up in the JS. My problem is I can't get the iframe to align using css or through styles in my html. I can move it around using css but I can't get it to line up either directly under the buttons, or in the center of the page.
<div class="center">
<button onclick="myFunction1()">Illustrators</button>
<button onclick="myFunction2()">Tech Writers</button>
</div>
<script>
var iframeExists = false;
function myFunction1() {
var x
if (!iframeExists) {
x = document.createElement("IFRAME");
iframeExists = true;
} else {
x = document.getElementsByTagName("IFRAME")[0];
}
x.setAttribute ("src", "http://www.oldgamer60.com/Project/Illustrators.php");
document.body.appendChild(x);
}
function myFunction2() {
var x;
if (!iframeExists) {
x = document.createElement("IFRAME");
iframeExists = true;
} else {
x = document.getElementsByTagName("IFRAME")[0];
}
x.setAttribute("src", "http://www.oldgamer60.com/Project/TechWriters.php");
document.body.appendChild(x);
}
</script>
CSS
iframe {
border: 0px solid #ffffff;
margin: auto;
width: 300px;
Height: 200px;}