How to insert Javascript within Javascript ?
0 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   Sherbir_S
Posted On:   Wednesday, July 28, 2004 02:59 AM

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 : 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 : Here's the SeePreview() function w   More>>

			
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 :


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 :


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('
onClick=javascript:window.close()>');
mywin.document.write(' ');

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.


   <<Less
About | Sitemap | Contact