Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6016409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 23, 20262026-05-23T02:58:42+00:00 2026-05-23T02:58:42+00:00

Ok So im trying to add an id to a link example: <a href=http://google.com/stats.php?go=normal>normal</a>

  • 0

Ok So im trying to add an id to a link example:

<a href="http://google.com/stats.php?go=normal">normal</a>  
<a href="http://google.com/stats.php?go=normalmedium">normal medium</a> 
<a href="http://google.com/stats.php?go=normalmediumhigh">normal medium high</a> 
<a href="http://google.com/stats.php?go=normalhigh">normal high</a> 
<a href="http://google.com/stats.php?go=superhigh">super high</a>

by default the links are like this but if they click on let say a button or link like this:

<a href="#" onclick="changeIt('bnone9099');>burner one</a> 
<a href="#" onclick="changeIt('bnone9034');>burner two</a> 
<a href="#" onclick="changeIt('bnone9098');>burner three</a>

when they click on one of the links it should add an id like this example if they click “burner one” :

<a href="http://google.com/stats.php?go=normal&id=bnone9099">normal</a>  
<a href="http://google.com/stats.php?go=normalmedium&id=bnone9099">normal medium</a> 
<a href="http://google.com/stats.php?go=normalmediumhigh&id=bnone9099">normal medium high</a> 
<a href="http://google.com/stats.php?go=normalhigh&id=bnone9099">normal high</a> 
<a href="http://google.com/stats.php?go=superhigh&id=bnone9099">super high</a>

and so on and if they click

<a href="#" onclick="changeIt('back');>default</a>

it should change the links back to normal like this

<a href="http://google.com/stats.php?go=normal">normal</a>  
<a href="http://google.com/stats.php?go=normalmedium">normal medium</a> 
<a href="http://google.com/stats.php?go=normalmediumhigh">normal medium high</a> 
<a href="http://google.com/stats.php?go=normalhigh">normal high</a> 
<a href="http://google.com/stats.php?go=superhigh">super high</a>

i hope this example is not too complicated! thanks 🙂

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-23T02:58:42+00:00Added an answer on May 23, 2026 at 2:58 am
    function changer(){
       var changedArr = [];
       this.changeIt = function($this, str ){
    
         if(str!="back"){
             $this = document.getElementById($this);
             $this.href = $this.href+"&id="+str;
             changedArr.push( $this );
         }else{
             for( var i=0, len=changedArr.length;i<len;i++){
               var lastInd = changedArr[i].href.lastIndexOf("&");
               changedArr[i].href = changedArr[i].href.substr(0,lastInd);
             }
         }
      };
    
    }
    
    var chHandler = new changer();
    

    and html…

    <a id="link1" href="http://google.com/stats.php?go=normal">normal</a>  
    <a id="link2" href="http://google.com/stats.php?go=normalmedium">normal medium</a> 
    <a id="link3" href="http://google.com/stats.php?go=normalmediumhigh">normal medium high</a> 
    <a id="link4" href="http://google.com/stats.php?go=normalhigh">normal high</a> 
    <a id="link5" href="http://google.com/stats.php?go=superhigh">super high</a>
    

    and…

    <a href="#" onclick="chHandler.changeIt('link1','bnone9099');">burner one</a> 
    <a href="#" onclick="chHandler.changeIt('link2','bnone9034');">burner two</a> 
    <a href="#" onclick="chHandler.changeIt('link3','bnone9098');">burner three</a>
    
    <a href="#" onclick="chHandler.changeIt('dummy','back');">BACK</a>
    

    Explanation of the above code.
    We are creating a new object of “changer()”, in the changeIt class, we are passing two arguments – the first is the id of the link who’s id is to be edited, and the second one is the value’s/id’s data.

    we are keeping the changed links into an array called changedArr, and when back is clicked (triggered because it sents ‘back’ as the second argument), we are doing a for-loop in the changedArr, and remove everything that follows the last occurance of &…. (which is always in this situation the id arg)

    You can see a working example here,
    http://jsfiddle.net/H2YHw/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

[EDIT: Here's a link to a mockup of what I'm trying to create] http://i53.tinypic.com/w9v2np.jpg
I am trying to add a link into the pop-up text bubble of a
I'm trying to dynamically add a css stylesheet rule using javascript, something like example
I'm trying to add event rich snippets to my site so that Google can
I'm trying to 'add a link' functionality to my site. For that I'm using
So im here trying to learn more php and... trying to add an image
I'm trying add a tab to my web page that looks like this: Using
Trying to add an onclick handler to my tabs, and can't seem to get
trying to add an ExpiresDefault ExpiresByType to content on my website so that way
Trying to add a 'box' to a form at design time, I looked up

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.