Link to home
Start Free TrialLog in
Avatar of RICHARDH
RICHARDH

asked on

javascipt

Is it possible for a php script to call a Javascript function located on the same page as the php code.

If not then is it possible to use the header command to send a message to open a particular page in a browser window of a set size.

Thanks for the help

Richard.H
Avatar of a.marsh
a.marsh

No....at least not directly.

The key may be to use javascript together with the link that is calling the PHP page.... is that how the PHP script is called by the user, by clicking a link?

If so then you could have the PHP script opened (and run) in a new window of a particular size by using (for example):

<a href="#" onclick="window.open('script.php','newwin','width=100,height=100'">open php page</a>


:o)

Ant
Sorry, make that:

<a href="#" onclick="window.open('script.php','newwin','width=100,height=100');">open php page</a>


:o)

Ant
Avatar of RICHARDH

ASKER

The php script is being called from a SUBMIT button as form details are being sent to the page, so this will not work I think.

Thanks for the help.
ASKER CERTIFIED SOLUTION
Avatar of a.marsh
a.marsh

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Personally I would go about it as follows:
Javascript = blablabla

Now, in your PHP, assign the javascript to a variable
$java = "blablabla";

And now simply echo $java in the correct place.
Hope I understand your question correctly...
as psimation:

<?
$javacript = "<script language=\"Javascript 1.2\">alert(\"hello\");</script>";
...
print $javascript:
?>
RICHARDH:

You have many open questions:

https://www.experts-exchange.com/jsp/qShow.jsp?qid=11342298
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11355858
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11382838
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11415199
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11670638
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20001107
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20004454
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20065368
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20073152
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20084825
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20084821
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20086663
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20086784
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20107892
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109405
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109357
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20109887
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20110886
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20117400
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118020
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118934
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20118648
https://www.experts-exchange.com/jsp/qShow.jsp?qid=11342618
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20130049
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20132692
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20142937
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20146293
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20147289
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20148615
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20149087
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20148609
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20150501
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20150630
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154720
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154865
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20154980
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20155947
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20180018
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20189434
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193459
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20222409
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20235436
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20244279
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20244276
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20193051
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20256056
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20257136
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20257135
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20127746
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20259971
https://www.experts-exchange.com/jsp/qShow.jsp?qid=20259964

To assist you in your cleanup, I'm providing the following guidelines:

1.  Stay active in your questions and provide feedback whenever possible. Likewise, when feedback has not been provided by the experts, commenting again makes them receive an email notification, and they may provide you with further information. Experts have no other method of searching for questions in which they have commented, except manually.

2.  Award points by hitting the Accept Comment As Answer button located above and to the left of that expert's comment.

3.  When grading, be sure to read:
https://www.experts-exchange.com/jsp/cmtyQuestAnswer.jsp#3
to ensure that you understand the grading system here at EE. If you grade less than an A, you must explain why.

4.  Questions that were not helpful to you should be PAQ'd (stored in the database for their valuable content?even if not valuable to you) or deleted. To PAQ or delete a question, you must first post your intent in that question to make the experts aware. Then, if no experts object after three full days, you can post a zero-point question at community support to request deletion or PAQ. Please include the link(s) to the question(s).
CS:  https://www.experts-exchange.com/jsp/qList.jsp?ta=commspt
At that point, a moderator can refund your points and PAQ or delete the question for you. The delete button does not work.

5.  If you fail to respond to this cleanup request, I must report you to the Community Support Administrator for further action.

Our intent is to get the questions cleaned up, and not to embarrass or shame anyone. If you have any questions or need further assistance at all, feel free to ask me in this question or post a zero-point question at CS. We are very happy to help you in this task!


thanks!
amp
community support moderator

1/27
Thanks for the help.
Problem now solved.

Richard
Glad to help.

Why only worth a B grade?

Ant
He has been giving ALL B's, Ant. I have already replied in one question, explaining that he needs to state why, but he has ignored or has not yet opened the notification.

:)
amp
Thanks amp. :o)

Ant