ggunzelman
New Coder
I have a simple information page that I display in an iFrame. The web page consists of a single table with 2 rows. The top row has a logo and some buttons. The 2nd row displays a .htm page in an iFrame. We'll call this page2024.htm. In the top row there is a Select construct to allow the user to choose page2023.htm. These are historical information pages. I can see the Select working as I watch the Chrome Console log but I cannot get the page to change properly. Instead of displaying the page in the same cell, it overwrites the entire web page with page2023.htm. Below is the code in question. I first set the cell to Page2024.htm and then a script executes on the Select change to change the page to the value in Select. I cannot figure out what is wrong. I am new to Javascript. The site was done in Dreamweaver and the two pages to display are .htm saves of Excel files.
HTML:
<tr data-id="xlsxDisplay" bgcolor="#FFFFFF">
<td colspan="2">
<iframe name="iFrame2" id="iFrame2" width="1980" height="925" frameborder="0" scrolling="yes" src="Page2024.htm"></iframe>
<a href="Page2024.xlsx">Download Excel File</a>
<script type="text/javascript">
$('#navYear').on('change',function(){
var url = $(this).val();
console.log(url)
document.getElementById("xlsxDisplay").innerHTML= document.write('<iframe id="iFrame2" scrolling="yes" height="925" width ="1980" frameborder="0" src='+url+'><\/iframe>');
})
</script>
Last edited by a moderator: