I want my two button's to open in the same iframe. So when button 1 was active I need button 2 to empty the frame and than load his link in there. Is this possible? This my code (so far):
<body>
<input type="button" id="knopSql1" type="submit" value="1e Klasse"></input>
<script>
document.getElementById('knopSql1').onclick = function() {
var iframe = frames[0] || document.createElement('iframe');
iframe.src='http://www.example.com/sql.php';
document.body.appendChild(iframe);
};
</script>
<input type="button" id="knopSql2" type="submit" value="2e Klasse"></input>
<script>
document.getElementById('knopSql2').onclick = function() {
var iframe = document.createElement('iframe');
iframe.src='http://www.example.com/sql2.php';
document.body.appendChild(iframe);
};
</script>
</body>