Subject: Using ASP in a javascript function
Posted By: Terry Joseph Migliorino Post Date: 12/10/2005 1:25:37 PM
I am trying to change a graphic by selecting a thumbnail from a menu.

The menu image has an onclick function which calls a javascript function and passes the number of the menuitem.

onclick="changeImage(1)"

The image is located in an ASP array created from a database when the page is opened, the javascript function is as follows:

function changeImage(i){
window.idBigPicURL.innerHTML="<img src='../images/gallery/<%=arrMenuData(7," + i + ")%>' />"
}

When I load the page the load ends here. If I take this function out the page loads ok but of course the onclick does nothing. Also if replace the ASP with <%=arrMenuData(7,2)%> every thing works ok.

So my question is how do I use the ASP with the number passed to the javascript function?

This is found on www.cjmnew.cjmgraphics.com.
Make the menu selection for either 'Digital Art' or 'Photographic Prints'.



Terry Migliorino
tmigliorino@usa.net
Reply By: Greg Griffiths Reply Date: 12/12/2005 3:17:50 PM
You can't as the ASP is on the Server Side and the Javascript is on the Client side, can you not store the array client side ?
Reply By: joefawcett Reply Date: 12/13/2005 4:48:05 AM
Examine the source code of the page in the browser, what does the script you've shown appear as?

--

Joe (Microsoft MVP - XML)

Go to topic 37491

Return to index page 418
Return to index page 417
Return to index page 416
Return to index page 415
Return to index page 414
Return to index page 413
Return to index page 412
Return to index page 411
Return to index page 410
Return to index page 409