Aziz Saleh – Software development

  • Home
  • Downloads
    • AzizMVC Downloads
      • Database Plugin
        • Template Plugin
    • Flash Builder 4
      • Bypass, Hijack, Beat, and Defeat Same Origin Policy
      • Flash Click Tracker
      • Flash Link Hider
      • Pacman source V 1.0
    • Java Downloads
      • Currency Converter
    • Javascript Downloads
    • PHP/MySQL Downloads
      • Aziz MVC
      • AzizMVC Documentation
      • Contact Form Maker
      • NetFlix API 1.0 Wrapper
      • Simple Blog
    • Visual Basic Downloads
      • Currency Converter
        • Key Logger w/Store, email, registry options
  • Resume & Portfolio
  • Ask me a question
  • Contact Me

Posted on December 25, 2010 by Aziz Posted in Javascript

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:

http://www.azizsaleh.com/index.php/?js=login

To pass parameters (pipe delimited), use:

http://www.azizsaleh.com/index.php/ResumeAndPortfolio/?js=showSection&jsp=2

 

<script type="text/javascript"> 
$(document).ready(function() { 
    // Check for JS by URL 
    // by azizsaleh @ azzisaleh.com 

    <?php 
    // Check if there is a javascript function 
    if(isset($_GET['js'])) 
    { 
        // set a time out @ 100 milliseconds 
        $js = 'setTimeout("'; 
        $js .= $_GET['js'].'('; 

        // Check for function paramters 
        if(isset($_GET['jsp'])) 
        { 
            // 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; 
    } 
    ?> 

}); 
</script>
« php_ssh2.dll VC6, VC7, VC8, VC9
Pacman like app »

Leave a comment Cancel reply

Your email address will not be published. Required fields are marked *

Recent Posts

  • PHP does not have MySQL support enabled.
  • Your PHP installation appears to be missing the MySQL extension which is required by WordPress
  • Undefined mysql functions (mysql_connect, mysql_select_db, mysql_query) – PDO alternative
  • Checking if you have Javascript installed by PHP
  • Process Maxmind countries, regions and cities – Parser to MySQL or SqLite

Recent Comments

  • fathima on Currency Converter Using Java Netbeans
  • Chris on Currency Converter
  • Khalid Ahmad Qweder on Resume & Portfolio
  • Michel on Currency Converter
  • Michel on Currency Converter

Archives

  • March 2014
  • September 2013
  • November 2012
  • October 2012
  • November 2011
  • February 2011
  • December 2010
  • November 2010
  • August 2010
  • May 2010
  • September 2009

Categories

  • Flash Builder 4
  • General
  • Java
  • Javascript
  • MySQL
  • PHP
  • Visual Basic

Meta

  • Register
  • Log in
  • Entries RSS
  • Comments RSS
  • WordPress.org
CyberChimps ©2025