Broodmdh
June 20th, 2008, 08:41 PM
I've got an application that uses master pages and content pages. I'm using a javascript function defined in the master page to launch a modal popup window. In the onLoad of the popup, I want to grab the contents of a div defined in the parent (in the content page portion) and display it in a div on the popup. I'm using the following code but it isn't working. Any suggestions?
var varHTML = parent.document.getElementByID("ReportDiv").InnerHTML;
document.getElementByID("PrintDiv").innerHTML = varHTML;
The problem seems to be that I am unable to find "ReportDiv" in the parent. I am using a simple div, but I've also tried adding runat="server" to the div and getting the clientID without success. I imagine that the problem lies with getting the element in a content page, but I don't know what to do about it. Any help would be appreciated.
var varHTML = parent.document.getElementByID("ReportDiv").InnerHTML;
document.getElementByID("PrintDiv").innerHTML = varHTML;
The problem seems to be that I am unable to find "ReportDiv" in the parent. I am using a simple div, but I've also tried adding runat="server" to the div and getting the clientID without success. I imagine that the problem lies with getting the element in a content page, but I don't know what to do about it. Any help would be appreciated.