?
Solved

Help with Javascript/Popup

Posted on 2007-07-25
5
Medium Priority
?
167 Views
Last Modified: 2010-04-16
Can anyone please help me understand why having script tag in the text passed to the window.write method doesn't work. I have the following html which I need to put that into a new popup

<HTML> <BODY><SCRIPT></SCRIPT><FORM><INPUT TYPE=&quot;hidden&quot; NAME=&quot;remoteSessionId&quot; VALUE=&quot;00002Er6QYYLNynw7O0aXnlh1mh:10uaq7rrh&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;pageName&quot; VALUE=&quot;Inbox&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;eventName&quot; VALUE=&quot;InboxRSEvent&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;marker&quot; VALUE=&quot;URL&quot;> </FORM> <!-- URL --> </BODY> </HTML>

I'm doing a window.Open and using Window.Write(<above htmlt>)
Its working fine if I remove the <script></script> tags, but I need to have them as I've got a js function in the above html. Can anyone suggest me a workaround or a fix for this please....
0
Comment
Question by:pnadakuditi
  • 2
  • 2
5 Comments
 
LVL 11

Expert Comment

by:raj3060
ID: 19565343
Move script inside HEAD tags..
0
 

Author Comment

by:pnadakuditi
ID: 19565445
tried moving into head tags...it didnt work....
0
 
LVL 4

Accepted Solution

by:
Lo-Tan earned 1500 total points
ID: 19565467
Take note of how I display the pop up and write to it.

You must close the document as well or else the web page keeps waiting for more information instead of closing the stream.

<html>
  <head>
      <title>Test Popup</title>
      <script type="text/javascript" language="JavaScript">
      <!--
      function showPopUp () {
        var myWindow = window.open ("","My Popup");
        myWindow.document.write ('<HTML><SCRIPT></SCRIPT><BODY><FORM><INPUT TYPE=&quot;hidden&quot; NAME=&quot;remoteSessionId&quot; VALUE=&quot;00002Er6QYYLNynw7O0aXnlh1mh:10uaq7rrh&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;pageName&quot; VALUE=&quot;Inbox&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;eventName&quot; VALUE=&quot;InboxRSEvent&quot;><INPUT TYPE=&quot;hidden&quot; NAME=&quot;marker&quot; VALUE=&quot;URL&quot;> </FORM></BODY> </HTML>');
        myWindow.document.close ();
      }
      -->
      </script>
  </head>
  <body>
      <input type="submit" value="Open Popup" onclick="javascript: showPopUp();"/>
  </body>
</html>
0
 
LVL 11

Expert Comment

by:raj3060
ID: 19565496
Not too different from above:

But you need to use document.write..
Instead window.write...
0
 
LVL 4

Expert Comment

by:Lo-Tan
ID: 19571223
Can you tell me what the solution required to have been warranted an A?
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

In threads here at EE, each comment has a unique Identifier (ID). It is easy to get the full path for an ID via the right-click context menu. However, we often want to post a short link within a thread rather than the full link. This article shows a…
This article discusses how to implement server side field validation and display customized error messages to the client.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).
Suggested Courses
Course of the Month13 days, 12 hours left to enroll

757 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question