a_krishnam_raju Posted March 30, 2006 Share Posted March 30, 2006 HiPlease go through the code below.test.html-----------------------------------------------------------------------<html><head><script language=JavaScript>function transferview(image,iname,webaddress) {info="<TITLE>"+iname+"</TITLE><body topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0' bgcolor='#CEDDFF'><table width='498'; height='500' cellpadding='2' cellspacing='2' bgcolor='#CEDDFF'>" + " <tr>" + " <td colspan='2' align='center' valign='middle'><IMG SRC='"+image+"' BORDER=0 /></td>" + " </tr>" + " <tr>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><font face='verdana, arial' size='2' color='#000066'>"+iname+"</font></td>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><form method='post' action='"+webaddress+"'><input type='submit' value='Request open yahoo in parent window' /></form>" + " </td>" + " </tr>" + "</table></body>"ImageWindow=window.open("", "newwin","toolbar=no,scrollbars=no, width=500, height=500");ImageWindow.document.write(info)ImageWindow.document.close()}</SCRIPT></head><body><a href="#" onclick="java script:transferview('test.jpg','Click the button to open yahoo', 'http://www.yahoo.com')">Open Pop UP</a></body></html>--------------------------------------------------------------------------What it actually does is:when i click on the text link in the parent window, it pops up a child window with a button ( and an image). What i want now is, if i click the button in pop up window, it should open the specified URL in the Parent window (which is at the back) and the pop up window should close.Please help me, i tried , tried , tried and now tired.Can you help with the script and can you tell me what code to add and where exactly.Please advise.Thank youKrishnam Link to comment Share on other sites More sharing options...
scott100 Posted March 30, 2006 Share Posted March 30, 2006 This is the code you needed, open the new page in the opener and then close itself.<input type='button' value='Request open yahoo in parent window' onclick=\"window.opener.location.href='"+webaddress+"';self.close()\" /> <html><head><script language=JavaScript>function transferview(image,iname,webaddress) {info="<TITLE>"+iname+"</TITLE><body topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0' bgcolor='#CEDDFF'><table width='498'; height='500' cellpadding='2' cellspacing='2' bgcolor='#CEDDFF'>" + " <tr>" + " <td colspan='2' align='center' valign='middle'><IMG SRC='"+image+"' BORDER=0 /></td>" + " </tr>" + " <tr>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><font face='verdana, arial' size='2' color='#000066'>"+iname+"</font></td>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><form><input type='button' value='Request open yahoo in parent window' onclick=\"window.opener.location.href='"+webaddress+"';self.close()\" /></form>" + " </td>" + " </tr>" + "</table></body>"ImageWindow=window.open("", "newwin","toolbar=no,scrollbars=no, width=500, height=500");ImageWindow.document.write(info)ImageWindow.document.close()}</SCRIPT></head><body><a href="#" onclick="java script:transferview('test.jpg','Click the button to open yahoo', 'http://www.yahoo.com')">Open Pop UP</a></body></html> Link to comment Share on other sites More sharing options...
a_krishnam_raju Posted March 30, 2006 Author Share Posted March 30, 2006 Hi ScottThanks a lot for the HELP.I copied the modified CODE that you have provided. But its showing up an error.Can you please check this up and provide me with the solution.Please help.Thank youKrishnam Link to comment Share on other sites More sharing options...
scott100 Posted March 30, 2006 Share Posted March 30, 2006 That's because when you copy the one above it doesn add in any of the formatting. You will have to manually go through it and clean up the code ie add returns and white space or you could just replace that one line of code on your original... Link to comment Share on other sites More sharing options...
a_krishnam_raju Posted March 30, 2006 Author Share Posted March 30, 2006 Hi Scott,I did what you have mentioned but still its giving up an error.I have also tried replacing my original code with of your but still its showing up an error.Can you please help.Thank youKrishnam Link to comment Share on other sites More sharing options...
scott100 Posted March 30, 2006 Share Posted March 30, 2006 <html><head><script language=JavaScript>function transferview(image,iname,webaddress) {info="<TITLE>"+iname+"</TITLE><body topmargin='0' leftmargin='0' rightmargin='0' bottommargin='0' bgcolor='#CEDDFF'><table width='498'; height='500' cellpadding='2' cellspacing='2' bgcolor='#CEDDFF'>" + " <tr>" + " <td colspan='2' align='center' valign='middle'><IMG SRC='"+image+"' BORDER=0 /></td>" + " </tr>" + " <tr>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><font face='verdana, arial' size='2' color='#000066'>"+iname+"</font></td>" + " <td width='243' height='22' align='center' bgcolor='#FFB7B9'><form><input type='button' value='Request open yahoo in parent window' onclick=\"window.opener.location.href='"+webaddress+"';self.close()\" /></form>" + " </td>" + " </tr>" + "</table></body>"ImageWindow=window.open("", "newwin","toolbar=no,scrollbars=no, width=500, height=500");ImageWindow.document.write(info)ImageWindow.document.close()}</SCRIPT></head><body><a href="#" onclick="java script:transferview('test.jpg','Click the button to open yahoo', 'http://www.yahoo.com')">Open Pop UP</a></body></html> Link to comment Share on other sites More sharing options...
a_krishnam_raju Posted March 30, 2006 Author Share Posted March 30, 2006 Hi Scott,Thanks a lot and i am very very very happy now.I was trying for the past 2 days and i was worried a lot.But Scott, you made my work easier.Thanks a lot for everything wonderful and I Love You.Cheers!Krishnam Link to comment Share on other sites More sharing options...
scott100 Posted March 30, 2006 Share Posted March 30, 2006 Glad i could get you over that final hurdle Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now