This was a question in a previous topic but I didn't quite understand the answer.

I display radio buttons from a Array I built in ASP (radioArray) which contains a code/short desc/long desc. When someone clicks a radio button I want to invoke a Javascript function to display the short and long desc directly below the list of radio buttons.

1. should I use onClick="return display_desc(this.selectedIndex)"
OR onchange="return display_desc(this.selectedIndex)"

2. How do I get radioArray into a JS array for the JS function?

Any code examples of would be very helpful since I am a novice at JS.
:?: :?:

I noticed this was unanswered. Speaking only for myself, I don't understand some of your terminology. I don't understand, when you speak of "arrays", whether you mean ASP arrays, JS arrays, or what.

Can you post some sample code? Or just describe in plain English what you're trying to do?

I noticed this was unanswered. Speaking only for myself, I don't understand some of your terminology. I don't understand, when you speak of "arrays", whether you mean ASP arrays, JS arrays, or what.

Can you post some sample code? Or just describe in plain English what you're trying to do?

I built an ASP Array that contains a (code/short desc/long desc) and then I display Radio Buttons for as many items that are in the array. When someone clicks on any of the Radio Buttons I need to display the short and long description for that radio button directly below the listed radio button. It's my understanding that I need to convert the ASP Array into a JS Array so I can then perform a JS routine to read the JS array and display the correct desc.

Hope that makes sense, Thank You

I think I need to see your "ASP Array".

The following is my current ASP code;

'Execute Stored Procedure and Load ASP Array
dim varMajCat() ' Array of Major Categories
set rsSub =cmd.execute ‘Executing SQL Server Stored Procedure
do until rsSub.eof
redim preserve varAppArray(3, intCount + 1)
varAppArray(1, intCount) = UCase(rsSub(strField1))
varAppArray(2, intCount) = UCase(rsSub(strField2))
varAppArray(3, intCount) = UCase(rsSub(strField3))
intCount = intCount + 1
rsSub.movenext
loop

'Loop thru the above Array & display the Maj Categories as Radio Buttons

Response.write("<Input Type='Radio' Name='MajCat' Language='_javascript' value='& varLocalArray(1, intCount) & ' onClick='return validate_radio_buttons()'>" & varLocalArray(2, intCount))

I need to figure out how to get the OnClick event to reference the data in the above Array and print the third element in an area that I will define directly below the Radio Buttons.

Thank you

If you want to *access* you VB array, you'll need to write it to your asp page... this is the only way your JS will get the opportunity to see it.

I am not sure I follow you. As I previously describe my Array was written in my ASP page but I just have to get my JS routine to be able to recognize it somehow. :?:

show us the code, and we will show you what we mean.

All of my ASP code to create the Array and to display the Radio buttons is up above, I just need to know how to reference the ASP array in my OnClick event which has not been code because I am not sure what to put in it.

Thank You, I appreciate the help.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.