I'm designing my webpage to use onclick functions to pull in data from other web pages and to display that data using iframe. The code works exactly as intended when I only have one button; however, when I add a second button and subsequent script, both buttons only pull in the data from the second script. How can I set this up so that EITHER button can be selected and return the proper page? Here's the code I'm working with:
<div class="section">
<button onclick="myFunction()">Illustrators</button>
<script>
function myFunction()
{
var x = document.createElement("IFRAME");
x.setAttribute("src", "http://www.oldgamer60.com/Project/Illustrators.php");
document.body.appendChild(x);
}
</script>
<button onclick="myFunction()">Tech Writers</button>
<script>
function myFunction()
{
var x = document.createElement("IFRAME");
x.setAttribute("src", "http://www.oldgamer60.com/Project/TechWriters.php");
document.body.appendChild(x);
}
</script>
</div>