473,387 Members | 3,801 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

passing value of javascript var in href

1
What I am trying to do is pass the value of a javascript variable as paramter in the href tag. below.. It seems that it should be possible but i can't see to get the right syntax... Any help would be appreciated.

[HTML]<a href="reports_Info_xl.cfm?term=javascript:thisTerm " target="_blank">Data (Excel Spreadsheet)</a>[/HTML]
Oct 3 '05 #1
1 4319
acoder
16,027 Expert Mod 8TB
If thisTerm does not change after page load, just use document.write():
Expand|Select|Wrap|Line Numbers
  1. document.write("<a href=\"reports_Info_xl.cfm?term="+ thisTerm + "target=\"_blank\">Data (Excel Spreadsheet)</a>");
If it does change, then give the anchor an id and change its href property dynamically:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById("anchorID").href = "reports_Info_xl.cfm?term=" + thisTerm;
Sep 10 '07 #2

Sign in to post your reply or Sign up for a free account.

Similar topics

5
by: Jim Banks | last post by:
Greetings I'm opening a pop up window with a html form, (in one document) and I want to pass a variable to the html form called from the hyperlink. Here's the code I'm using to pop up the...
1
by: franklinbruce | last post by:
Hi all, I have a ASP script which will get 2 query string value. i put val1 Value in a session and pass val2 value to javascript for parent page reload with the specified value. Problem i face is...
1
by: Newbie | last post by:
Is there a way to pass strings from one webform to another without using Response.Redirect( ) ? The reason is that I need the webform passing the string to close its window.
7
by: Oleg Konovalov | last post by:
Hi, I am trying to pass a bunch of checked checkboxes (Javascript array) from page1 to the Java action class on subsequent web page (page2). (on page 1 I have a bunch of DB rows with a checkbox,...
3
by: Brian | last post by:
Hope someone can help ..... Have a function which creates a HTML HREF function fLink(aText) { return '<a href=javascript:DoLinkSearch("'+aText+'")>'+aText+'</a>'; } If the parameter value is...
4
by: Xerxes | last post by:
Hi all, I am trying to pass a value of a field as an argument to href but I am not doing it right: <select name="sel_name" id="sel_id"><option>....</option>.... <a...
2
by: =?Utf-8?B?Um95?= | last post by:
Hi all, In a form I have a text called myText as input and need to pass its value to the next page (mySecond.asp) The following works fine and my next page I get the value of myText=test: <a...
6
by: haijdp | last post by:
Hi, I am using the following javascript method inside a js file. function createDivRow(label,text) { var formedTd = '<tr><td>' + label + '</td><td> <a href="#"...
8
by: ridgedale | last post by:
I wonder if anyone could explain how I pass the field values in my request form to the PHP processor page. My external javascript file is as follows: var sections = ; for (var i=0; i <...
3
by: NobodyImportant | last post by:
Hello everyone! I admit up front that I am new at this and have very little knowledge of JavaScript, but we have an asp web form that allows for the manipulation of letters our company regularly...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.