Skip to content Skip to sidebar Skip to footer

Javascript - Window.onload - Put Content Of A
Onto A New Window

I would like to write a java script which: When the page loads takes the content of a
tag and Places that content on a popup page. any ideas for the script? I know

Solution 1:

window.onload = function() {

  var el = document.getElementById("ctl00_Main_OTClaim1_valControls");
  var html = "";

  if (el) {
    html = document.getElementById("ctl00_Main_OTClaim1_valControls").innerHTML;
    var xopen = window.open("about:blank");
    xopen.document.write(html);
  }
}

--UPDATE

window.onload = function() {

  var el = document.getElementById("ctl00_Main_OTClaim1_valControls"); //the element you want expandedvar html = "";

  if (el) {
    html = el.innerHTML;
    var xopen = window.open("about:blank");
    xopen.document.write(html);
  }
}

Solution 2:

Like:

varcopy = document.getElementById("validationDiv").innerHTML;

Then to create the new window:

var newWin = window.open("", "My window", "width=250,height=250,scrollbars=1,resizable=1")
newWin.document.write("<html><head></head><body>" + copy + "</body></html>")

Solution 3:

Something like:

<script>window.onload = function() {
    my_window = window.open ("","mywindow1","status=1,width=350,height=150"); 
    my_window.document.write(document.getElementById('someDiv').innertHTML);  
};
</script>

Post a Comment for "Javascript - Window.onload - Put Content Of A
Onto A New Window"