View Full Version : get combo box name
PQSIK
11-25-2002, 02:15 AM
Can someone tell me how to get the name of a combo box
with javascript.
i.e. this.combo box name
glenngv
11-25-2002, 02:29 AM
<select name="mycombo" onclick="alert(this.name)">
could you explain further what you actually want to accomplish?
PQSIK
11-25-2002, 02:39 AM
Hi, thank for your reply.
sorry for not explaining it better.
the combo boxes are created with values from a database.
<select size="1" name="<% Response.write RS("DataNumber") %>" onchange="Assign(this);">
<% dim c
for c = 1 to 10 %>
<option><% c %></option>
<% next
%>
</select>
I then call this function.
function Assign(a)
{
y is for the name of the combo box
y = a.name;
t = a.options[a.selectedIndex].value;
s = document.verify.y.value;
document.verify.y.value = t * y;
}
I am trying to get the value of the combo box and * with the value in a text box.
Is that better.
PQSIK.
glenngv
11-25-2002, 03:09 AM
what are you trying to do there? Change the value of the combo box? But you don't set the value of the options here:
<%
for c = 1 to 10 %>
<option><% c %></option>
<% next
%>
it should have been:
<%
for c = 1 to 10 %>
<option value="<% =c%>"><% =c%></option>
<% next
%>
please explain what exactly the Assign() function should do.
vBulletin® v3.8.2, Copyright ©2000-2012, Jelsoft Enterprises Ltd.