New MoD and a Javascript Gift to All

This is a discussion on "New MoD and a Javascript Gift to All" within the JavaScript Forum section. This forum, and the thread "New MoD and a Javascript Gift to All are both part of the Program Your Website category.



Go Back   Webforumz.com > Main Forums > Program Your Website > JavaScript Forum

Notices


Closed Thread
 
LinkBack Thread Tools
  #1 (permalink)  
Old Aug 19th, 2003, 19:47
vor vor is offline
Junior Member
Join Date: Aug 2003
Posts: 17
Thanks: 0
Thanked 0 Times in 0 Posts
New MoD and a Javascript Gift to All

Apparently I'm the new MoD of Javascript. I'll try not to become drunk with this new Found Powa.

Here's a sample source i wrote a long time ago. Basicly, it allows you to grab querystring data with javascript. Pretty useful when you need a dynamic site and need to pass data back and forth and it has to work offline.

Here's a Link to my Personal SourceCode Archive. Since i'm a freelancer, I like to have my personal scripts available when I need them. Rape and Pillage my poor CodeChive.

http://www.cybernerdz.net/sites/cchive/

Code: Select all
//script by pedro 'vor' sousa
   var parms = request(); //lets get our parms

   //Output all the Parms Sent to the Page
   if(! isArray(parms)){ //if not an array
      document.write("No Parms");
   }else{ //ITs an Array !
      for(var item in parms){
         document.write("[" + item + ] = " + parms[item] + "
");
      }//end for
   }//end if

   //FUNCTION ==========================================================
   //Put all parms after ? into an array. (same as in ASP)
   function request(){
     var parmList = document.location.search;//get the parms after the ?
     if(parmList != ""){//do we have any parms in the var
        parmList = parmList.replace("?","")//Lets get rid of the question mark
        var pat = /\+/gi; parmList = parmList.replace(pat," ")//Lets replace all + to spaces
        parmList = parmList.split("&"); //Lets divide each var/value

        //Create a Hash Array
        var ary = new Array(),tary;
        for(var x=0;x < parmList.length;x++){
          tary = parmList[x].split("="); //divide the var and value
          if(tary.length == 2){// only if we have 2 elements
             ary[tary[0]] = unescape(tary[1]); //Fix any UrlEncoding
          }// end if
        }//end if

        return ary;
     }else{ //We dont have any parms
        return "";
     }//end if
   }// end function
   //++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
   //checks to see if variable is an Array
   function isArray(check){
    if(typeof check == "object"){
       return(parms.constructor.toString().match(/array/i) != null);
    }//end if
    return false;
   }//function

  #2 (permalink)  
Old Aug 19th, 2003, 20:13
Rob's Avatar
Rob Rob is offline
Head Admin & CEO

SuperMember
Join Date: Jul 2003
Location: at my desk
Age: 34
Posts: 2,952
Blog Entries: 7
Thanks: 7
Thanked 4 Times in 4 Posts
Send a message via MSN to Rob Send a message via Skype™ to Rob
You got da power....!!!

Nice piece of code by the way...
__________________
Rob - SEO Specialist
Owner & Founder of Webforumz.com

I am currently unavailable for private work
  #3 (permalink)  
Old Aug 20th, 2003, 07:53
Reputable Member
Join Date: Aug 2003
Location: United Kingdom
Posts: 158
Thanks: 0
Thanked 0 Times in 0 Posts
I like the way you have made it accessible on your site, very clean! I have plans to do something like this for myself, but msaccess based.

Well done mate!

u2o
  #4 (permalink)  
Old Aug 21st, 2003, 15:27
Most Reputable Member
Join Date: Jul 2003
Posts: 1,856
Thanks: 0
Thanked 0 Times in 0 Posts
This is why Vor is Mod for Javascript and I'm not.... Because Vor knows what he's talking about
Closed Thread

Tags
mod, javascript, gift

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Similar Threads
Thread Thread Starter Forum Replies Last Post
javascript in php iochinome PHP Forum 2 Feb 13th, 2008 21:30
The Perfect Christmas Gift? Monie Webforumz Cafe 28 Dec 10th, 2007 00:57
javascript help !! aicirt JavaScript Forum 0 Jul 20th, 2006 06:56
what does \\ mean in javascript jenjen1018 JavaScript Forum 5 Jan 6th, 2004 17:05


All times are GMT. The time now is 22:18.


Powered by vBulletin®
Copyright ©2000 - 2008, Jelsoft Enterprises Ltd.
Search Engine Friendly URLs by vBSEO 3.2.0 RC8
© 2003-2008 Webforumz.com : All Rights Reserved

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43