Last week, we had the author of TDD for a Shopping Website LiveProject. Friday at 11am Ranch time, Steven Solomon will be hosting a live TDD session just for us. See for the agenda and registration link
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Paul Clapham
  • Ron McLeod
  • Jeanne Boyarsky
  • Tim Cooke
Sheriffs:
  • Liutauras Vilda
  • paul wheaton
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Tim Holloway
  • Stephan van Hulst
  • Carey Brown
  • Frits Walraven
Bartenders:
  • Piet Souris
  • Himai Minh

Setting dynamic parameter values?

 
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
I want to call my javaScript function with a parameter value that is determined dynamically. When I call my showWine function from my <a> tag I get an undefined variable error. What is the best way to code this simple functionality?
I have reduced my jsp code to illustrate my problem.

[ September 26, 2002: Message edited by: Rich Smyth ]
 
Ranch Hand
Posts: 403
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Maybe try this:
 
Rich Smyth
Ranch Hand
Posts: 87
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks James it worked. I applied your idea to the code on which my simple example was based and also got that to work. But i'm not sure if I did it correctly.
I ultimately want to use the parameter of my showWine function as a parameter for a jsp. I had to build the url that uses this parameter in a separate statement, outside the open.window call. Is there a way to use just a single statement? I tried variations of ".../aboutTheFeaturedWine.jsp?promo=<%= feature %>" but that didn't work
The version of my function that works but is perhaps not elegant:
<SCRIPT LANGUAGE="JavaScript">
function showWine(feature) {
featurePage = "http://localhost:8080/WineProject/aboutTheFeaturedWine.jsp?promo=" + feature
var porps = window.open(featurePage, "windowFeaturedWine", "toolbars=1, scrollbars=1, menubars=0, resizable=1, width=400, height= 200");
}
</SCRIPT>
 
Good heavens! What have you done! Here, try to fix it with this tiny ad:
free, earth-friendly heat - a kickstarter for putting coin in your pocket while saving the earth
https://coderanch.com/t/751654/free-earth-friendly-heat-kickstarter
reply
    Bookmark Topic Watch Topic
  • New Topic