Search Results

Search found 1 results on 1 pages for 'user300797'.

Page 1/1 | 1 

  • Passing unknown amounts of variables using through a string string and eval and multiple functions a

    - by user300797
    I'm not sure how best to describe this problem... In short, I want to use object literal to allow me to pass a random amount of variables in any order to a function. Whilst this is not big deal in theory, in my code, this object literal is passed to a second function call on_change. on_change works comparing an element inner HTML to a string. if it is the same, it sets a time out of to call the function again (this is sort of/almost recursive, but the function dose actually get to end before it is called again). if the elements inner HTML is different from the string, then the third parameter is executed. this will either be a function or a string. either way it will execute. I have tested this function plenty and used it for a while now. how ever, it cannot seem to get the object literal to flow through the function calls... var params = { xpos:'false'}; on_change('window_3_cont_buffer','',' if(Window_manager.windows[3].window_cont_buffer.getElementsByTagName(\'content\')[0].getElementsByTagName(\'p\')[0].innerHTML == \'ERROR\'){ alert(Window_manager.windows[3].window_cont_buffer.getElementsByTagName(\'content\')[0].getElementsByTagName(\'p\')[1].innerHTML); return false; } else { Window_manager.windows[3].load_xml(\'location/view.php?location_ID=3\', \'\', ' + params + ' ); } '); I call this as part of the form submission. after this line, I then call a function to load some content via ajax, which works fine and will trigger the code from the on_change function. I have tested load_xml function it is able to call alert(param.xpos) and get the correct response. I can even added in a check for being undefined so that rest of the times I cam load_xml I don't get swamped with alerts. The load_xml function first set up the on_change function, then calls the function to load the content to a hidden div. Once the AJAX request has updated that DIV, the on_change function should now call the parse_xml function. This pulls out the information from the xml file. How ever... The idea of this object literal param is that it can tell this parse_xml function to ignore certain things. on_change("window_" + this.id + "_cont_buffer", "", "Window_manager.windows[" + this.id + "].parse_xml('" + param + "')"); this is part of load_xml. it works perfectly fine, even with the param bit in there. except, parse_xml dose not seem to be able to use that parameter. I have been able to get it to a point where parse_xml can alert(param) and give [object object] which I would of thought meant that the object litteral had been passed through, but when I try and call alert(param.xpos) I get undefined. I know this is a pig of a problem, and I could get around it by just having the function take a zillion boolean parameters, but its just not practical or elegant. I'm sure you will need to ask me plenty more questions before I can solve this. I will post more complete code, I just cut it down to what is actually going on. Thanks

    Read the article

1