Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
|
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 10th, 2005, 02:25 PM
Registered User
 
Join Date: Oct 2005
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default Using ASP in a javascript function

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
[email protected]
 
Old December 12th, 2005, 04:17 PM
Friend of Wrox
 
Join Date: Jun 2003
Posts: 344
Thanks: 0
Thanked 1 Time in 1 Post
Default

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 ?
 
Old December 13th, 2005, 05:48 AM
joefawcett's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

Examine the source code of the page in the browser, what does the script you've shown appear as?

--

Joe (Microsoft MVP - XML)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Single quote in function Parameter ASP -Javascript Hem96 Classic ASP Professional 4 September 14th, 2007 09:10 AM
Calling javascript function from with in ASP kawal.singh Classic ASP Basics 1 July 4th, 2007 05:17 AM
javaScript function in asp.net not work in firefox rsanuj ASP.NET 1.x and 2.0 Application Design 1 February 8th, 2007 11:37 AM
How to call javascript function from VB function vinod_yadav1919 VB How-To 0 February 13th, 2006 06:03 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.