Have a dropdown box of Animal Type. Based on what the user selects, a second dropdown box Species is filled in with the Specie Common Names based on the animal selected. The onchange function from the Animal Type dropdown is fillSpecies. I am running into a problem when the Species has a ‘ in the name (i.e. Wren, Bewick’s) in the rs to write out. An error message of missing ) appears. How do I do a replacement of ‘ in the vbscript code within JavaScript?
Any suggestions????
function fillSpecies()
{
<%
set rs2 = (Server.CreateObject(“ADODB.Recordset”))
rs2.Open “SELECT Common_Name, AnimalID from tblAnimals where Type = 6”, mConn
n = 0
do while not rs2.EOF
Response.Write “document.UserForm.Species1[” & n & “] = new Option(‘””” + rs2(“Common_Name”) + “””‘,” & rs2(“AnimalID”) & “);”
rs2.MoveNext
n = n + 1
loop
rs2.Close
%>
}