473,394 Members | 1,709 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,394 software developers and data experts.

Need help in passing a javascript variable into a hyperlink

10
Hi friends...I need our help.I'm stuck with this code...

can some one tell me how can pass a javascript variable into hyperlink along with a php varaible?

Here is my code..
Expand|Select|Wrap|Line Numbers
  1. <html>
  2. <head>
  3. <script type="text/javascript">
  4. function favBrowser()
  5. {
  6. var mylist=document.getElementById("myList")
  7. document.getElementById("favorite").value=mylist.options[mylist.selectedIndex].text
  8. }
  9. </script>
  10. </head>
  11.  
  12. <body>
  13. <form>
  14. Select your favorite browser:
  15. <select id="myList" onchange="favBrowser()">
  16.   <option>Internet Explorer</option>
  17.   <option>Netscape</option>
  18.  </select>
  19. <p>Your favorite browser is: <input type="text" id="favorite" size="20"></p>
  20. </form>
  21. <a href='mypage.php?var1=$xxx&val2='>Link</a>
  22. </body>
  23. </html>
  24.  
It displays the selected value in the text box with help of 'id' attribute.

Now i want display that selected value in a hyperlink too...

i.e.
Expand|Select|Wrap|Line Numbers
  1. <a href='mypage.php?var1=$xxx&val2='>Link</a>
here var1 is my php varaible and var2 will be the selected drop box value.

so when i click this hyperlink it should contain two variables values.

Thanks in advance.
Aug 29 '07 #1
1 2483
pbmods
5,821 Expert 4TB
Heya, Abertay.

Please use CODE tags when posting source code. See the REPLY GUIDELINES on the right side of the page next time you post.
Aug 29 '07 #2

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

Similar topics

1
by: Newbie | last post by:
OK, this may be impossible since I'm using 3rd party shopping cart ASP software, but I've been able to finagle a lot of other stuff I thought wouldn't work, so here we go: I'm using a form in...
2
by: Patrice | last post by:
HI, 1- I fill an array (arrayName ) of records (news and news titles) from an ACCESS database. 2- I call a function (loopDatasNews()) to build a table of news titles. 3- I call javascript...
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...
2
by: jbatty | last post by:
I am trying to display an image on my page by using "img src= hyperlink". the hyperlink is stored in a c# variable. but i seem to have the syntax mixed up. This passing the image directly works...
3
by: Shapper | last post by:
Hello, I am working on an ASP.NET/VB web site. I have several links including menu links. Considerer a want to load a page named page.aspx. I can do it using javascript. Or using this code:...
3
by: amjad | last post by:
Hi i have a webpage which has datagrid with one column called customer ID.. that customer ID is hyperlink mean i a click that customer ID it open a web page and display that customer ID on that...
5
by: widevision7 | last post by:
I am creating a web site where I want to have a hyperlink that executes a Perl script. At the same time, I want to pass along a variable inside of the hyperlink that the Perl script can use when it...
1
jenkinsloveschicken
by: jenkinsloveschicken | last post by:
I am needing help passing a GET variable to a receiving php page. This html page does not contain an forms for submission(POST/GET methods). First I need to parse the URL string using...
1
by: Wolfman | last post by:
Hi gang! I've been searching for a solution to this problem extensively but nothing really hits the mark. I have a descriptive popup page that contains a PayPal order button. The normal PayPal...
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
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?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
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
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
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...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.