Click to See Complete Forum and Search --> : popup not popping up


new_developer
03-28-2006, 07:40 PM
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,
new_developer

phpnovice
03-28-2006, 07:52 PM
You overlooked one thing. Change this:

onClick='PilotQuestionnairePopupPrintView; return false;'

to this:

onClick="PilotQuestionnairePopupPrintView(); return false;"

The other change I made is because HTML really prefers it if you use double quotes around attribute values.

new_developer
03-28-2006, 08:05 PM
Hi - thank you for the quick reply. I made the changes but my window is still not popping up. Is there anything else I need to do?

newdeveloper

Valvert
03-28-2006, 09:00 PM
Unless I'm misunderstanding something, it seems to me that you aren't passing any arguments in your new function call--

onClick="PilotQuestionnairePopupPrintView(); return false;"

--when your function definition--

function PilotQuestionnairePopupPrintView(go) {
...
}

--requires that one parameter. I don't know what the rest of your application looks like, but I would suggest just deleting "go" and see what happens.

phpnovice
03-28-2006, 11:50 PM
I made the changes but my window is still not popping up. Is there anything else I need to do?
Is there a popup-blocker involved? Otherwise, you'll have to provide a live link to your page on the Internet. Then, I can run my Interactive JavaScript Debugger on it for some real accurate analysis of the situation. ;)

new_developer
03-29-2006, 05:25 AM
Hi,

no popup blocker involved. I did make a change to match the other functions and function calls to the following:

onClick="PilotQuestionnairePopupPrintView(0); return false;"

I wasn't passing anything originally. Actually, the popup window it calls has code in it to retrieve data from the database with a $_SESSION variable.