Hi all,
I'm trying to use the following script:
<script language="javaScript">
function setrepto(){
document.aForm.repno.value =
document.aForm.rep.options[document.aForm.rep.selectedIndex].value;
}
</script>
On the following form (Partly in asp):
<form name="aForm">
<select name="rep" OnChange="setrepto();">
<option value="ALL">Select a Rep Here</option>
<%
while not slsrs.eof
repno = slsrs("SLS#")
repname = slsrs("SLSNAM")%>
<option value="<%=repno%>"><%=repname%></option>
<%slsrs.movenext
wend%>
</select>
</form>
To change the value of 'repno' in the following href, which is on the
same page:
<a href="nextpage.asp?rep=<%=repno%>">Click here</a>
So basically, as a user changes the selection, the value of repno in
the above href should change.
Can't get it to work. Can anyone help?
TIA,
Paul 2 4379
I *think* what you're saying is that you'd like to change
the page when the user makes a selection from that list?
If that's the case, try this:
<script language="JavaScript">
function setrepto()
{
var myRep =
document.aForm.rep.options
[document.aForm.rep.selectedIndex].value;
self.location = "nextpage.asp?rep=" + myRep;
}
</script>
You can get rid of the anchor link altogether... -----Original Message----- Hi all, I'm trying to use the following script:
<script language="javaScript"> function setrepto(){ document.aForm.repno.value = document.aForm.rep.options
[document.aForm.rep.selectedIndex].value;} </script>
On the following form (Partly in asp):
<form name="aForm"> <select name="rep" OnChange="setrepto();"> <option value="ALL">Select a Rep Here</option> <% while not slsrs.eof repno = slsrs("SLS#") repname = slsrs("SLSNAM")%> <option value="<%=repno%>"><%=repname%></option> <%slsrs.movenext wend%> </select> </form>
To change the value of 'repno' in the following href,
which is on thesame page:
<a href="nextpage.asp?rep=<%=repno%>">Click here</a>
So basically, as a user changes the selection, the value
of repno inthe above href should change.
Can't get it to work. Can anyone help?
TIA, Paul .
Paul,
Study this example. Paste this html code into a file and view it.
You'll need to make a javascript function for each rep from in the
ASP.
<html><head>
<SCRIPT LANGUAGE="JavaScript">
<!--
function onChange_Rep(ob){
var ii = 0
var ix = ob.selectedIndex
var cat_value = ob.options[ix].value
// hardcoded these categories, can generalize later
if (cat_value == "0")
load_SW_urls()
if (cat_value == "1")
load_GD_urls()
}
function load_SW_urls(){
// Keep deleting first item til all gone
while (document.aForm.thread.length)
document.aForm.thread.options[0] = null
len = document.aForm.thread.length;
document.aForm.thread.options[len] = new
Option("http://www.joinarnold.com", "0",false,true)
len = document.aForm.thread.length;
document.aForm.thread.options[len] = new
Option("http://joinarnold.meetup.com", "1",false,true)
}
function load_GD_urls(){
// Keep deleting first item til all gone
while (document.aForm.thread.length)
document.aForm.thread.options[0] = null
len = document.aForm.thread.length;
document.aForm.thread.options[len] = new Option("http://www.aclu.org",
"0",false,true)
len = document.aForm.thread.length;
document.aForm.thread.options[len] = new
Option("http://www.totalrecall2003.com", "1",false,true)
}
function button_focus()
{
document.aForm.rep.focus()
}
function do_onload() {
load_SW_urls();
button_focus();
}
//-->
</script>
</head><body onLoad="do_onload()" bgcolor=efefaaa >
<center>
<form name=aForm>
<table cellpadding=3 cellspacing=0 border=1 bgcolor=silver width=280 >
<td bgcolor=silver>
<p>
<font face="Tacoma, Verdana, Helvetica" size=2>
<b>Rep</b></font>
<td bgcolor=silver>
<p>
<font face="Tacoma, Verdana, Helvetica" size=2>
<b>Thread</b></font>
</tr>
<tr bgcolor=silver>
<td valign=top>
<select name="rep" onChange="onChange_Rep(this)" >
<option value="0">Arnold Schwarzenegger</option>
<option value="1">Graay Daviss</option>
</select>
<td rowspan=3 valign=top>
<select name="thread" size=1 >
<option value="bogus">____________________</option>
</select>
</tr>
</table>
</form>
</center>
</body>
</html> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Philo Del Middleston |
last post by:
I've been searching, but apparently not phrasing my search right, so I'm
going to float a question out here in the meantime...
I'm wondering how to go about refreshing the content of a control...
|
by: Scott |
last post by:
I'm new to ASP, but I've been programming in VB for
several years, and I'm having a few issues with this ASP
enhancement I'm working on. I've found ASP to be a lot
different than what I'm use to...
|
by: Paul Eghbal |
last post by:
Hi all,
I'm trying to use the following script:
<script language="javaScript">
function setrepto(){
document.aForm.repno.value =
document.aForm.rep.options.value;
}
</script>
|
by: Marcello |
last post by:
Hello
I have a page of 2 frame:
menu (menu.php)
corpo (corpo.php)
In menu.php i have:
<script>
function selAut(){
aut=autore.selectedIndex;
aut=autore.options.value;
|
by: Dan |
last post by:
Can anyone offer suggestions on how to do this or if it is possible?
I have a form that uses a drop down box and 2 text fields.
What I am trying to do is have the value of each text box set by...
|
by: Scott Tilton |
last post by:
I am having a terrible time getting this to work. I am hoping someone out
there can help me with very specific code examples. I am trying to get the
linked tables in my Access 97 database to be...
|
by: Marcin Domaslawski |
last post by:
Hi,
I've got simple script which adds to pointed DIV another DIV which contains
1 combobox (select) and textbox (input) - it's a AddNewRow() function. Every
field has got unique ID (acording with...
|
by: honey99 |
last post by:
Hi!
I have to fix a problem in JSP.Actually,i have a JSP page say Ex1.jsp.In this Ex1.jsp i have an anchor tag which links into another JSP page i.e when i click on the link another pop-up window...
|
by: robtyketto |
last post by:
Greetings,
I'm slowly building up code to do the following:-
Display TWO selection option boxes (cascading).
If the FIRST selection option box changes then reload the jsp using onchange...
|
by: ruds |
last post by:
Hello,
I have a JSP page in which HTML form elements are present.
I have a drop down list named Country, when a user selects his country
I want another drop down list to populate based on the...
|
by: ryjfgjl |
last post by:
ExcelToDatabase: batch import excel into database automatically...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: isladogs |
last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM).
In this month's session, we are pleased to welcome back...
|
by: Vimpel783 |
last post by:
Hello!
Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
|
by: jfyes |
last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
|
by: ArrayDB |
last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
|
by: Shællîpôpï 09 |
last post by:
If u are using a keypad phone, how do u turn on JavaScript, to access features like WhatsApp, Facebook, Instagram....
|
by: af34tf |
last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
| |