JerryWa0h Posted August 20, 2014 Share Posted August 20, 2014 I have bought and read larrys php for the web 4th edition, and php and javascript. I am having trouble with the example in chapter 11 of php and javascript .. accessing a javascript function form inside php. can somesone send me an email so I can describee the problem. I spend all morning typing the question in notepad but for some reason I cant copy/paste it to forum box .. tried ctrl/c-ctrl/v .. edit-copy/edit-paste .. right click copy/paste .. nothing works at 73 with arthritus in my hands, if I try to type is again it will contain typping errors. jerry gentry .. www.wa0h.com .. jerrywa0h@sbcglobal.net Link to comment Share on other sites More sharing options...
Larry Posted August 20, 2014 Share Posted August 20, 2014 Hey Jerry. You really should be able to copy/paste here (sorry about your arthritis). Maybe try a different browser? Link to comment Share on other sites More sharing options...
Larry Posted August 21, 2014 Share Posted August 21, 2014 Is this the entire code you're using? <?php print "Click to call JS function (MyJsFnct)"; ?> Link to comment Share on other sites More sharing options...
Necuima Posted October 22, 2014 Share Posted October 22, 2014 Hi Jerry, I did not see this earlier but here's an example of accessing a JavaScript function from within PHP... First, the function - note that it has a built-in fadeout so the redirection takes 5 seconds whilst fading - it also uses jQuery: function redirect() { $('#fadeout_area').fadeOut(5000); setTimeout(function() { window.location.replace('./index.php?p=whatever'); }, 5000); } now the PHP invocation of the JS function: echo '<script type="text/javascript">', 'redirect();', '</script>'; Hope it helps. Cheers from Oz. Link to comment Share on other sites More sharing options...
Recommended Posts