I am currently making a website for school and I'm quite inexperienced.
The problem I've encountered is:
I have an iframe on a homepage, which I want to make longer depending on the link clicked.
That part is easy, what is not however is making the iframe longer when clicking on a link within the iframe.
So I have an external script in which I do
function getObj(name)
{
if (document.getElementById)
{
this.obj = document.getElementById(name);
this.style = document.getElementById(name).style;
}
else if (document.all)
{
this.obj = document.all[name];
this.style = document.all[name].style;
}
else if (document.layers)
{
this.obj = document.layers[name];
this.style = document.layers[name];
}
}
var frame, div1;
function mainInit(){
frame = new getObj("idFrame");
}
function init2(){
div1 = new getObj("divWithTable");
div1.style.visibility = "hidden";
}
function ShowDiv(){
div1.style.visibility = "visible";
//frame.obj.height = 1000;
}
So I have a <body onload="mainInit()">
on my homepage and a <body onload="init2()">
on the page within the iframe, which also has a button with an onclick="ShowDiv()"
.
What the problem is now is:
I can not change the length of the iframe when I click a button that shows a div on the page within it. I would need to somehow return the defined iframe from the first page, so I can use it on the second.