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 TouchToneTommy on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

popup window not popping up

Status
Not open for further replies.

newdeveloper

Programmer
Mar 28, 2006
4
US
Hi,

I am totally new (as of today) to javascript and I have a question. I am developing a page in php (also new) and would like my data to pop up in a print window. There are existing pages that do this so I copied and modified code. We have a javascript file to which I added the following function:

function PilotQuestionnairePopupPrintView(go)
{
var winPrintView = window.open('index.php?a=PopupPilotQuestionnaire&nohead=true', 'PrintPopup', 'width=1000,height=600,scrollbars=yes,resizable=yes,toolbar=yes');

winPrintView.focus();
}

Like I said, I copied an existing function and just renamed it in the appropriate places.

Then I created my PopupPilotQuestionnaire file and I am calling it as follows from another page:

<td width="26%" valign="top" align="right">
<p align="right"><IMG ALT="" BORDER=0 SRC="images/shared_bullet_triangle.gif" width="5" height="9"><a href='' onClick='PilotQuestionnairePopupPrintView; return false;'>print</a></td>

This works for all the other pages/functions but my window does not pop up. I can physically type in the address of the 'popup page' and it comes up, but not when I click the 'print' link.

Can anybody help?

Thanks,
newdeveloper
 
>This works for all the other pages/functions but my window does not pop up
meaning it does not work... is that what you mean?

>Then I created my PopupPilotQuestionnaire file and I am calling it as follows from another page
The function calls index.php not Popup... file? What do you mean by "from another page"! The function and the <a href ...> should be on the same page? Or I miss something!

[1] Your function does not use any argument and seems not be called with one. Hence the "go" is not necessary.
[tt] function PilotQuestionnairePopupPrintView[highlight]()[/highlight][/tt]

[2] When you call it with onclick, you need to include parentheses operator.
[tt]<a href='[green]javascript:void(0)[/green]' onClick='PilotQuestionnairePopupPrintView[COLOR=red yellow]()[/color]; return false;'>print</a>[/tt]


 
Hi,

Yes I meant that it does not work.

The pages are all set up so that a=file_name calls the respecitve file, therefore the a=PopupPilotQuestionnaire should call a page called PopupPilotQuestionnaire.inc. It is the same way all the other popup windows are called and it works. I can physically type the a=PopupPilotQuestionnaire in the URL string adn it calls the 'popup' page, but calling the function does not call the page. In Firefox it does nothing, in IE it goes back to my main menu. Any thoughts?

As for the 'onclick', that is how the other developer calls all the functions.
 
If I get what you meant, maybe this?
[tt]
<a href='javascript:void(0)' onClick='PilotQuestionnairePopupPrintView("PopupPilotQuestionnaire"); return false;'>print</a>
[/tt]
Then the function.
[tt]
function PilotQuestionnairePopupPrintView(go) {
var winPrintView = window.open('index.php?a='+escape(go)+'&nohead=true', 'PrintPopup', 'width=1000,height=600,scrollbars=yes,resizable=yes,toolbar=yes');
winPrintView.focus();
}
[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top