Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old December 12th, 2003, 12:54 PM
Authorized User
Join Date: Jul 2003
Location: , , .
Posts: 56
Thanks: 0
Thanked 0 Times in 0 Posts
Default How Do I Pass 2 Variables in Javascript

Hi there

Could anyone help me with the following problem:

I've got a dropdown box which is populated from a database. The dropdown displays a TName but passes through TID.

<select name="TID" id="TID" onchange='JavaScript:window.location="pageurl_edit .asp?TID=" + this.value;'>

This all worked fine on my insert page but I need to tweak it for my edit page and am not really a javascript bod!

I need to pass through another variable called UID

On my edit page i've got some asp:
Dim uid
if Request("uid") <> "" then uid = Request("uid")

So, what I need to put in my select box onchange function is this:
pass through TID which is equal to the value of the select box (as before) and pass through UID which is equal to Request("uid") but I don't know how to write this in javascript.

Can anyone help?

Thanks in advance


Reply With Quote
  #2 (permalink)  
Old December 12th, 2003, 05:18 PM
planoie's Avatar
Friend of Wrox
Points: 16,481, Level: 55
Points: 16,481, Level: 55 Points: 16,481, Level: 55 Points: 16,481, Level: 55
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Aug 2003
Location: Clifton Park, New York, USA.
Posts: 5,407
Thanks: 0
Thanked 16 Times in 16 Posts

I think is what you want... UID is going to be the same for all TIDs right?

<select name="TID" id="TID" onchange="window.location='pageurl_edit.asp?TID=' + this.value + '&uid=<%=uid%>';">

Work smarter, not harder.
Reply With Quote
  #3 (permalink)  
Old December 13th, 2003, 11:25 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts

The slight problem with that solution is that it uses an IE only construct, a select element does not have a value in standard HTML. The general construct would be:
<select name="TID" id="TID" onchange="window.location='pageurl_edit.asp?TID=' + this.options[this.selectedIndex].value + '&uid=<%=uid%>';">

Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

Similar Threads
Thread Thread Starter Forum Replies Last Post
Pass Variables obrienkev C# 2005 1 July 18th, 2008 03:58 AM
How do I Pass Session Variables cdanczak Classic ASP Professional 0 November 27th, 2007 10:42 AM
how can I pass variables to vb? astarti Beginning VB 6 4 September 5th, 2007 08:43 AM
Is it better to pass variables to a function? stephen_c_ Beginning PHP 3 November 4th, 2005 05:07 AM
Q. How do I pass PHP variables to JavaScript? Snib PHP FAQs 0 April 8th, 2004 11:34 AM

All times are GMT -4. The time now is 05:19 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.