/    Sign up×
Community /Pin to ProfileBookmark

replacing ‘ in vbscript within Javascript

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
%>
}

to post a comment
JavaScript

1 Comments(s)

Copy linkTweet thisAlerts:
@sunriseauthorMay 21.2003 — thank you
×

Success!

Help @sunrise spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...