rsprik Report post Posted October 25, 2007 I have a successful implementation of a seating chart solution using DragNode. I'm just trying to learn more about the JavaScript semantics to code more efficiently and advance my own learning... JavaScript function: function updateChartfoo(DOMId){ //Get reference to chart object using Dom ID var chartObj = getChartFromId("MyChart"); var suffix = 'foo'; //Update it's URL chartObj.setDataURL("/MyXML_" + suffix + ".xml"); Later in the HTML there's a button... including this: onclick="javaScript:updateChartfoo();" I have 3 different XML source files... let's call them: MyXML_foo.xml MyXML_bar.xml MyXML_blort.xml I'm trying to create one function to make the code efficient, but I could not figure out how to pass along the value I want to assign the suffix variable from the onclick event. I tried updateChart(foo); and then in the function I started with: updateChart(DOMId,suffix) .... and other variations.... none of which worked Sorry, my JS skills aren't where they need to be and so for now I had to settle for creating three different functions. Is there any way to pass along additional arguments to the updateChart(DOMId) function from the onClick trigger? Thanks! Share this post Link to post Share on other sites
FusionCharts Support Report post Posted October 30, 2007 surely, What was missing was that the onclick events will pass the suffix values ..tahts a must... and the function receiving that sufix value in proper order...i mean see the example below..we are passing the suffix as second argument, hence we will receive as seceond agrument in the functon declaration .... for 3 different suffixes we will need 3 links.. all you need to do are : HTML part : 1. onclick="updateChart('ChartId1','foo');" 2.onclick="updateChart('ChartId1','bar');" 3.onclick="updateChart('ChartId1','blort');" JAvascript part : function updateChart(DOMId,suffix){ var chartObj = getChartFromId("MyChart"); chartObj.setDataURL("/MyXML_" + suffix + ".xml"); Share this post Link to post Share on other sites