If you realy need string parameter you could do some string parsing and the function would look something like this:
/* * focusTheElement(string) * the parameter should have the folowing format : * 'form_name.element_name' */ fuction focusTheElement(element) { var form=element.substring(1,element.indexOf('.')); var child=element.substring(element.indexOf('.')+1,element.length); /* You should test the function and see if it works well use : alert(form); or document.write('form="'+form+'"<br/>'); alert(child); or document.write("child='"+child+"'<br/>"); */ /* then you should do something like this: */ document.forms[form].elements[child].focus(); } or /* * focusTheElement(string) * the parameter should have the folowing format : * 'form_name.element_name' * I don't know if this function will improve the speed but it would do the job! */ fuction focusTheElement(element) { eval('document.'+element+'.focus();'); } If you do not ned a string parameter you could use what John Nichel wrote before me. On Wed, 2003-02-19 at 17:47, Christian Ista wrote: > Hello, > > Example, I have this function : > > void function MyExampleFunction(){ > document.form_name.element_name.focus(); > } > > I'd like do something like that, I call the function like that : > MyExampleFunction('form_name.element_name'); > > And do that : > void function MyExampleFunction(theelement){ > document.theelement.focus(); > } > > but that's not work ? > > An idea ? > > Christian, -- Mincu Alexandru intelinet.ro Tel:+4 0745 369719 +4 021 3140021 www.intelinet.ro [EMAIL PROTECTED] -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php