Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Chris Miller on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

window opener error. 1

Status
Not open for further replies.

project3

Technical User
Jan 10, 2008
22
US
ok i have a pop up. and on clicking in the popup i have the following code.

if (!window.opener)
{
alert("Couldnt find window opener. Unable to append email");

}

so that means it found it but the minute. I try to do anything with the window.opener it errors.

like I tried all kinds of things just to change bg color.
put text in text box

opener.document.newticketform.opt_userphone.value = "test";


whatever i add that involves the window.opener halts the program at that line.

I don't get this at all?
 
This works for me..

Code:
var parent_win = window.opener;
parent_win.document.newticketform.opt_userphone.value = 'test';

Maybe the [tt][maroon]opener[/maroon][/tt] does not work standalone without the [tt][maroon]window[/maroon][/tt] object, I haven't checked it..


- Lowet

[gray]Why can't all browsers parse pages the same way? It should be the Web designer who decides how to display the content, not the browser![/gray]
 
It should...

What happens when you change your prompt code to:
Code:
if (window.opener)
    {
        alert("I found the window opener.");
        
    }

Never be afraid to share your dreams with the world.
There's nothing the world loves more than the taste of really sweet dreams.

Webflo
 
alert("test1");
var parent_win = window.opener;
alert("test2");
parent_win.document.newticketform.opt_userphone.value = 'test';
alert("test3");


i get alert test1 and test2 but not test3
 
dwarfthrower

running this code:

if (window.opener)
{
alert("I found the window opener.");

}

i get the alertbox with I found the window opener.
 
now i can get it to work inside another popup window thats blank. but i need it to work in the other. why would code work calling a function in one popup and not another?
 
now i can get it to work inside another popup window thats blank. but i need it to work in the other. why would code work calling a function in one popup and not another?

Possibly because the element you are trying to reference does not exist. Unfortunately IE will not be so forthcoming with detailed information about such errors.

This seems like it should be an easy problem to debug if you were using the right tools. I would suggest downloading firefox if you're not using it already. Secondly, there are 2 plugins that I use every day when developing firefox:

Web Developer Toolbar

-and-

Firebug

With those 2 extensions, debugging problems like the one you've just posted will become extremely trivial. In IE I imagine that you're getting the little yellow triangle icon in the lower left hand side of your page, and when you double click it it gives you a message saying "object expected" - not helpful at all. Using the firefox tools above it will pinpoint which line the error is on, and highlight the section of the code causing problems.

Load up your page with the suggestions above and come back to let us know if you're having any more problems. Trust me, you really need to have these 2 tools if you're doing web development - you can thanks me later [smile]

-kaht

Lisa, if you don't like your job you don't strike. You just go in every day and do it really half-assed. That's the American way. - Homer Simpson

[small]<P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <B> <P> <.</B>[/small]
 
I figured out what was wrong. the pop up had an ajax contact selector on it. the script settings for the domain had the domain as i switched it to domain.com and worked just fine not sure why that is but its working hip hip hoooray.

Thanks kaht for the firefox extensions that will be nice. I use firefox already its my favorite!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top