codetoad.com
  ASP Shopping CartForum & BBS
  - all for $20 from CodeToad Plus!
  
  Home || ASP | ASP.Net | C++/C# | DHTML | HTML | Java | Javascript | Perl | VB | XML || CodeToad Plus! || Forums || RAM 
Search Site:
Search Forums:
  How to insert Javascript within Javascript ?  sherbir at 10:51 on Wednesday, July 28, 2004
 

I have a simple problem.

I want to insert Javascript within Javascript ???
Seems weird !!!

Here's the scenario :
I have created a JSP in which I have a function that Submits the main form in the main window.
Here's the function :

function SubmitContent()
{
document.f1.method='post';
document.f1.action='http://localhost:8080/examples/sherbir/texteditor2/page2.jsp';
document.f1.submit();
}

and here's the form description :
<form name='f1'>

But before that, on clicking the submit button in the main window, I am opening a child window to perform a few operations as follows :
<input type="button" name="bttn_preview" value="Preview" onClick="javascript:SeePreview()">

Here's the SeePreview() function which opens the child window:
function SeePreview()
{
var mywin=window.open("","","menubar=no,toolbar=no,scrollbars=yes,width=800,height=450");
mywin.moveTo(0,50);
mywin.document.write('<input type=button value="Make more changes"
onClick=javascript:window.close()>');
mywin.document.write('<input type="submit" name="child_bttn_sub" value="Proceed" onClick=self.close(); self.opener.SubmitContent();>');

The child window in turn has a submit button as defined above.

On clicking this button, I want the child window to close and hence submit the parent form also.

It's not happening !!

I even tried changing the order of the two statements in the OnClick event of the submit button in the child window.
I also tried self.opener.document.forms[0].submit()

None works.

Where's the problem ??

How do I remedy the situation ?

Please Help.








CodeToad Experts

Can't find the answer?
Our Site experts are answering questions for free in the CodeToad forums








Recent Forum Threads
•  Re: ASP Email System Source Code
•  Learning VB(Looking for opinions)
•  How to open a .DOC file in MS-Word thru a link
•  Export database`s data into a CSV file in jspscript.....
•  Adding values to text field from popup - JavaScript
•  How to insert Javascript within Javascript ?
•  Event Close Browser botton
•  setting alphanumeric code
•  syntax error in insert statement .please help me solve it


Recent Articles
Simple Thumbnail Solution
Type Anywhere
A Better Moustrap: FmtDate to replace FormatDateTime
ASP.NET Forum Source Code
Internal Search Engine
Javascript Growing Window
Simple date validation
Search engine friendly URLs using ASP.NET (C#.NET)
Function to Return Alpha Characters Only
The OSI Reference Model - A Clear and Concise Illustration !


Site Survey
Help us serve you better. Take a five minute survey. Click here!

© Copyright codetoad.com 2001-2004