Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations IamaSherpa on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem with Javascript within a VB Com Object

Status
Not open for further replies.

Cranger

Programmer
Apr 4, 2001
54
US
I am generating HTML within a VB cls. This object is invoked from an ASP Page. The Page generates Fine, but I am having problems with My onchange function. Here are the snippits of my code. The intent is, when my selection box changes I want this onclick function to envoke and redirect itself back to the same page.....

' this is my function


ASPresponse.Write &quot;<HEAD>&quot;
ASPresponse.Write &quot;<script ID=clientEventHandlersJS LANGUAGE=javascript>&quot;
ASPresponse.Write &quot;<!--&quot;
ASPresponse.Write &quot;function sCompany_onchange() {&quot;
ASPresponse.Write &quot;Var intCompanyID&quot;
ASPresponse.Write &quot;Var strURL&quot;
ASPresponse.Write &quot;intCompanyID=frmMain.sCompany.value&quot; 'gets the selected company's id
ASPresponse.Write &quot;strURL = 'LogIncident.asp?intCompanyID=' + intCompanyID&quot;
ASPresponse.Write &quot;location = strURL&quot; 'will redirect the page to itself with the company id in the querystring&quot;
ASPresponse.Write &quot;}&quot;
ASPresponse.Write &quot;//-->&quot;
ASPresponse.Write &quot;</script>&quot;

' this is where I call my function

ASPresponse.Write &quot;<TD Width=450><SELECT name=sCompany id=sCompany LANGUAGE=javascript onchange=return sCompany_onchange()&quot;


Any help?
 
This works:

<html>
<head>
<script lANGUAGE=javascript>
function sCompany_onchange() {
location = 'LogIncident.asp?intCompanyID=' + document.frmMain.sCompany.value;
}
</script>
</head>


<form name=frmMain>
<SELECT name=sCompany id=sCompany onchange=&quot;sCompany_onchange();&quot;>
<option value=1>Test
<option value=2>Tast
<option value=3>Tust
</select>
</form>
</html>





br
Gerard
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top