Categorized | Featured Articles

Passing Arguments With Simple Html?

Hi, I need to pass an affiliate ID string from one html file to another for as long as the user is browsing my site.
Can someone please explain to me how to do this using a simple java script function (no php or asp).
In my command line I would put something like: mypage.html?affiliateid=1234
How would I retrieve this parameter and then put it in every link on my page so that it is passed on to any page the user surfs to?
Any help would be greatly appreciated.

No Responses to “Passing Arguments With Simple Html?”

  1. Coyote Girl says:

    Do a search under hidden form variables for tutorials. I`m not enough of an html expert, just asp.net.

  2. stratsan says:

    cookieshttp://www.w3schools.com/js/js_cookies.a…

  3. Dan says:

    You can use JavaScript to parse the query string:


    A link is going here:

  4. Ratchetr says:

    You can add a bit of JavaScript to each page that updates each link on the page with the affiliateid.
    Below is some sample code. A few notes:
    * I used jquery rather than raw JavaScript. I’m too spoiled by JQuery to do it manually. (maybe someone else will write you a JQuery-less version.
    * I copied all the URL parameters from the link to each link on the page. I think that’s all you need, but if you need to only copy affiliateid and ignore other parameters, it would need to be tweaked.
    * I used yahoo and google as links for testing. They seem to ignore the affiliateid parameter, page still loads 😉
    * If you have other links on your page that shouldn’t have the affiliateid parameter, then it would need to be tweaked.
    Code:
    Yahoo doesn’t handle code very well, so I put it on pastebin:http://pastebin.com/aeh7UTPZ

Trackbacks/Pingbacks


Leave a Reply

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

Archives

Powered by Yahoo! Answers