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 9106825
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 17, 20262026-06-17T02:25:44+00:00 2026-06-17T02:25:44+00:00

I have been trying to create a hyperlink using a variable defined earlier in

  • 0

I have been trying to create a hyperlink using a variable defined earlier in the same function to append:

var NAMEVARIABLE = responseArray[i].Name;

var TITLE_Game = document.createElement("p");
TITLE_Game.className = "TITLE_Game";
TITLE_Game.innerHTML = "<a href='Game_NAMEVARIABLE.html'>Games</a>";

I have tried the following using the solution found here: Passing Javascript variable to <a href >

<a href="Game_.html" onclick="location.href=this.href+'?key='+NAMEVARIABLE;return false;">Games</a>

But that didn’t work. I then tried adding an ID:

<a id="link" href="Game_.html?propid=">Games</a>

And adding this to the script: document.links["link"].href += NAMEVARIABLE;

This didn’t work either. These links are occuring within Isotope, which I’ve run into newbie-problems making sure my JSON data is loading before the script executes. That’s all working now, but I’m not sure if the reason the above methods aren’t working is because of a similar issue, or if they simply are not the proper way to go about this.

Any help is much appreciated. Thank you

  • 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-06-17T02:25:46+00:00Added an answer on June 17, 2026 at 2:25 am

    first of all, try debug your variable :

    var NAMEVARIABLE = responseArray[i].Name;
    alert(NAMEVARIABLE);
    

    is it returning the desired return value or not.
    and then the second thing, in your first style of script, try this instead :

    TITLE_Game.innerHTML = "<a href='Game_"+NAMEVARIABLE+".html'>Games</a>";
    

    I assumed you have (static) html collection with game_[number_id].html format
    and if it’s so, you can try further with your second style of script, and change it to this :

    <a href="#" onclick="location.href='Game_'+NAMEVARIABLE+'.html';return false;">Games</a>
    

    you need to learn further about javascript strings concatenation

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

Sidebar

Related Questions

I have been trying to create a pointer variable in the called function and
I have been trying to create a ListView which I can sort using drag
I have been trying to create an observable tweeter feed using tweetsharp with the
I have been trying to create an XML using the simplexml library (v2.6.2) http://simple.sourceforge.net/home.php
I have been trying to create rotating object using jQuery and without any other
I have been trying to create pong game using ncurses library on a terminal
I have been trying to create a page using views that will list down
I have been trying to create an image from PDF using c#, I have
I have been trying to create a simple calculator. Using PHP I managed to
I have been trying to create pie chart using rally sdk with the following

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.