• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

Passing a parameter to a link inside an < a > href tag

 
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I am currently working with a website using only HTML. I have variables being passed in the URL that are read by a javascript and I then take the parameter for each variable and populate it into a Google javascript.

JS reading the URL:

The variable to be written to the second JS:

The portion of the Google JS that is written to:

All of this has been working quite well for me. Those parameters are passed into Google ads but I still have several links on the page that do not have the '?pid1=' variable attached. I would like to be able to do one of the following:

1. Take the parameter from the variable 'pid1' and pass it into a link located in a < a > tag. ( NOTE: I do have multiple variables, example.com/index.html?pid1=abc&pid2=def&pid3=ghi )

2. Strip from the URL, starting with the ? and everything thereafter and attach it to one link or all links located in a < a > tag(s) on the page.

3. Strip from the URL, starting with the ? and only a selected set of variable(s) and attach it to one link or all links located in a < a > tag(s) on the page.

Very important note, my JS knowledge is limited to asking questions and taking what I get and trying to figure it out from there, which is what I am hoping to do here. Thanks in advance for any help provided.

-jorge
 
author
Posts: 15385
6
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
 
Jorge Romero
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Eric,

What you put together was perfect for what I needed. I made some minor modifications but ultimately I would not have been able to put something like this together myself.

Thank you very much!

-jorge
 
reply
    Bookmark Topic Watch Topic
  • New Topic