• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 333
  • Last Modified:

Javascript Help

I am trying to Print the contents of the textarea and in all browsers except IE8.0.6001, it works fine

<script language="javascript">
function printerfriendly() {
  childWin = open("", "childWin", "location=yes, menubar=yes, toolbar=yes, scrollbars=yes");
  var text = document.printfrm.editDetails.value;
  childWin.document.write(text);
}
</script>

what happens is when i click the-print button, it banks empty page and below shows the image is being downloaded, it keeps waiting unless and until i press the refresh[f5] and then it appears OK,

other browsers, it works fine

can anyone guide why this stupid IE behavior
0
Gurpreet Singh Randhawa
Asked:
Gurpreet Singh Randhawa
1 Solution
 
Tom BeckCommented:
I would try a different syntax on this line:

var text = document.printfrm.editDetails.value;

Perhaps:

var text = document.forms[0].editDetails.value;

Or:

var text = document.getElementById("editDetails").value;
0
 
RoonaanCommented:
Try replacing:
childWin.document.write(text);

Open in new window

with
childWin.document.open();
childWin.document.write(text);
childWin.document.close();

Open in new window

0
 
Gurpreet Singh RandhawaWeb DeveloperAuthor Commented:
Can you explain it Please why it worked this way
0

Featured Post

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

One of a set of tools we're offering as a way to say thank you for being a part of the community.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now