dcsimg
ASP in Javascript
1 posts in topic
Flat View  Flat View
TOPIC ACTIONS:
 

Posted By:   archie_smith
Posted On:   Monday, September 8, 2003 09:32 AM

I have a vbscript multi-element array that I want to access in my javascript function. This function will populate a form dropdown. I'm having trouble accessing the array properly. Thanks for the help. function PopSecSelect(probID){ DynmOption=new Option(); for (var iRowLoop = 0; iRowLoop < <%= UBound(CatArray, 2)%>; iRowLoop++){ DynmOption.text= <%= CatArray(1, iRowLoop)%>; DynmOption.value= <%= CatArray(0, iRowLoop)%>; document.theForm.txtSubCat.options [document.theForm.txtSubCat.options.length] = DynmOption; } }    More>>

I have a vbscript multi-element array that I want to access in my javascript function. This function will populate a form dropdown. I'm having trouble accessing the array properly. Thanks for the help.


function PopSecSelect(probID){

DynmOption=new Option();

for (var iRowLoop = 0; iRowLoop < <%= UBound(CatArray, 2)%>; iRowLoop++){

DynmOption.text= <%= CatArray(1, iRowLoop)%>;

DynmOption.value= <%= CatArray(0, iRowLoop)%>;

document.theForm.txtSubCat.options
[document.theForm.txtSubCat.options.length] = DynmOption;

}

}

   <<Less

Re: ASP in Javascript

Posted By:   Firat_Tiryaki  
Posted On:   Tuesday, September 9, 2003 03:06 AM

well, you are trying to use the asp array values in a javascript loop. instead of this you should create a javascript array with asp and use it.



I don't ever write ASP but your code logic should look like below with ASP



<%


Request.writeln("MyArray=new Array();")
for(i in the index of your array){

Request.writeln("MyArray["+i+"]="+CatArray[i]+";");


}

%>

Try to understand the logic, I am very far from ASP syntax.
About | Sitemap | Contact