dastaten Posted June 8, 2008 Share Posted June 8, 2008 I have a bit of javascript that I need to run in a php file. Can someone tell me the code to do this in php? <SCRIPT type="text/javascript"> if (confirm("Sign in to Instant Messenger? (Be sure to disable pop-up blocker)") ) { newwindow=window.open('php121/php121im.php','name','height=500,width=240,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no'); if (window.focus) {newwindow.focus()}; } </SCRIPT> I just opens an alert box and if "Ok" is clicked, opens another small window with specific attributes. Any help is greatly appreciated. Thanks, DAStaten Quote Link to comment Share on other sites More sharing options...
MiCR0 Posted June 8, 2008 Share Posted June 8, 2008 echo "<SCRIPT type=\"text/javascript\"> if (confirm(\"Sign in to Instant Messenger? (Be sure to disable pop-up blocker)\") ) { newwindow=window.open('php121/php121im.php','name','height=500,width=240,left=20,top=20,toolbar=no,menubar=no,directories=no,location=no,scrollbars=yes,status=no,resizable=yes,fullscreen=no'); if (window.focus) {newwindow.focus()}; } </SCRIPT>"; Quote Link to comment Share on other sites More sharing options...
dastaten Posted June 8, 2008 Author Share Posted June 8, 2008 Ah, I remember "echo" now lol. Thanks so much! Quote Link to comment Share on other sites More sharing options...
dastaten Posted June 8, 2008 Author Share Posted June 8, 2008 Well, I spoke too soon. That will only write the code to the page. I need that snippet to execute when the php page loads. The php page should pop up the alert box and then call the other page when "Ok" is clicked. Am I making sense? Quote Link to comment Share on other sites More sharing options...
keeB Posted June 8, 2008 Share Posted June 8, 2008 Am I making sense? No Quote Link to comment Share on other sites More sharing options...
serverman Posted June 8, 2008 Share Posted June 8, 2008 i think he wants it from java to php lol Quote Link to comment Share on other sites More sharing options...
corbin Posted June 8, 2008 Share Posted June 8, 2008 PHP can not make a popup on the client side... You can output javascript, which will in turn make a popup, but you can't make a popup with PHP, if that makes sense. Quote Link to comment Share on other sites More sharing options...
blueman378 Posted June 9, 2008 Share Posted June 9, 2008 so what you will need to do, is set the function and then call it with body onload, Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.