You are not logged In.
Calling Javascript functions from PHP
If you have designed websites using jQuery, you might have noticed that you are limited to showing certain sections/parts of your websites with direct URL. This is due to the fact that it is mostly user interaction of clicking, mouseover, etc..

This is a small function that will allow you to call certain Javascript functions passed in the URL parameters.

For example, if I would want a user to view the login screen I have on my website, they would visit:

To pass parameters (pipe delimited), use:

PHP Code: <?php

<script type="text/javascript">
document).ready(function() {
    // Check for JS by URL
    // by azizsaleh @
// Check if there is a javascript function
        // set a time out @ 100 milliseconds
        $js 'setTimeout("';
        $js .= $_GET['js'].'(';
// Check for function paramters
            // Print variables
            $jsParamters explode('|',$_GET['jsp']);
            for($x=0;$x<count($jsParamters);$x++){ $js .= "'".$jsParamters[$x]."',";}
            if(strlen($js) > strlen($_GET['js'])+13    ){ $js substr($js,0,-1);}            
        $js .= ')",100);';
        echo $js;


© Aziz S. Hussain 2009, except where otherwise stated
Contact Me - My Resume & Portfolio - Privacy Policy - TOS