Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 2 of 2
  1. #1
    New to the CF scene
    Join Date
    Jan 2009
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy pull variables from URL and post in document code?

    my url read index.html?pagego=collections

    here it he code I have that is pulling the variables from the URL

    Code:
    function getUrlVars(){
    var vars = [], hash;
    var hashes = window.location.href.slice(window.location.href.indexOf('?') + 1).split('&');
     
    for(var i = 0; i < hashes.length; i++){
    hash = hashes[i].split('=');
    vars.push(hash[0]);
    vars[hash[0]] = hash[1];
    }
    
    return vars;
    }
    and here is the code I use to alert

    Code:
    var hash = getUrlVars(); 
    alert(hash['pagego']);
    this works perfectly and alerts with the variable when I load he page.

    Now when i am embedding my flash file i want to pass the variable to my flash by just adding the variable value to my embed code.

    how can I do this?

    here is my swf embed code
    Code:
    	var so = new SWFObject("main2.swf?pagego="+THIS IS WHERE I WANT THE VARIABLE TO BE, "Preview", "100%", "100%", "9", "#ffffff", true);
    		so.addParam("scale", "noscale");
    		so.addParam("salign", "lt");
                    so.write("flashcontent");

  • #2
    Senior Coder
    Join Date
    Oct 2008
    Location
    Long Beach
    Posts
    1,196
    Thanks
    36
    Thanked 164 Times in 164 Posts
    Code:
    	var so = new SWFObject("main2.swf?pagego="+hash["pagego"], "Preview", "100%", "100%", "9", "#ffffff", true);
    		so.addParam("scale", "noscale");
    		so.addParam("salign", "lt");
                    so.write("flashcontent");
    Feel free to e-mail me if I forget to respond ;)
    ohsosexybrit@gmail.com


  •  

    Tags for this Thread

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •