javascript - How to change the order of which they are called? -


i have quite inconvenient problem.

say have following functions

function name(namearg){ ... .. }  function handlefailed(){ .. .. } function handlecover(){ .. .. } 

now problem, have alot of hard coded html can't changed calling both functions this

<a href="javascript:handlecover();javascript:name('mss')">link</a> <a href="javascript:handlefailed();javascript:name('gps')">link</a> <a href="javascript:handlefailed();javascript:name('nps')">link</a> 

the problem order of i'm calling functions, first want see function called, either handlefailed() or handlecover(), , want know name sent name function.

if have called functions in other way around have done

var thename;  function name(namearg){   thename = namearg }  function handlefailed(){ callotherfunctioninanotherjavascript(getelements(thename + ".failed")); } function handlecover(){ callotherfunctioninanotherjavascript(getelements(thename + ".cover")); } 

but not possible since i'm calling name function after first function. there way in javascript "changes" order of how functions evaluated, or guys have clever sollution problem, i.e getting value of namearg variable , use in handlefailed() & handlecover() functions?

var postfix; function name(namearg){     callotherfunctioninanotherjavascript(getelements(namearg + postfix));     } function handlefailed(){ postfix = '.failed'; }       function handlecover(){ postfix = '.cover'; } 

Comments

Popular posts from this blog

c# - SharpSVN - How to get the previous revision? -

c++ - Is it possible to compile a VST on linux? -

url - Querystring manipulation of email Address in PHP -