[PHP] Javascript function
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, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript function
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, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript function
You'll probably have better luck addressing your question to a list that supports JavaScript. 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, -- By-Tor.com It's all about the Rush http://www.by-tor.com -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Javascript function
Try this. void function MyExampleFunction(theelement) { theelement.focus() } body onload=MyExampleFunction(document.form_name.element_name) The variable theelement will refer to document.form_name.element_name so there is no reason to repeat that portion in the function. Robbert van Andel -Original Message- From: Christian Ista [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:48 AM To: [EMAIL PROTECTED] Subject: [PHP] Javascript function 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, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
Re: [PHP] Javascript function
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
Re: [PHP] Javascript function
There are a lot of other handlers that can call your function: onChange, onFocus, onBlur, onMouseOver, onKeyDown, etc.. gl :) Van Andel [EMAIL PROTECTED] schreef in bericht news:[EMAIL PROTECTED] m... Try this. void function MyExampleFunction(theelement) { theelement.focus() } body onload=MyExampleFunction(document.form_name.element_name) The variable theelement will refer to document.form_name.element_name so there is no reason to repeat that portion in the function. Robbert van Andel -Original Message- From: Christian Ista [mailto:[EMAIL PROTECTED]] Sent: Wednesday, February 19, 2003 7:48 AM To: [EMAIL PROTECTED] Subject: [PHP] Javascript function 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, -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
[PHP] Javascript function
Hi Is it possible to call a function in a javascriptpage from a PHP page? I have a function, which I use when the user press a button. I would like to call this function just by typing the name. Is that possible? Thanks, Morten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Javascript function
Is it possible to call a function in a javascriptpage from a PHP page? Javascriptpage? Do you mean using JavaScript to call a PHP function? NO, it is not. Because PHP is SERVER-SIDE and JavaScript is CLIENT-SIDE. You can do vice versa though. Sincerely, Maxim Maletsky Founder, Chief Developer www.PHPBeginner.com // where PHP Begins -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php
RE: [PHP] Javascript function
No. PHP is server side, Javascript is client side and their code does not mix. ---John Holmes... -Original Message- From: Morten Nielsen [mailto:[EMAIL PROTECTED]] Sent: Saturday, May 04, 2002 2:42 AM To: [EMAIL PROTECTED] Subject: [PHP] Javascript function Hi Is it possible to call a function in a javascriptpage from a PHP page? I have a function, which I use when the user press a button. I would like to call this function just by typing the name. Is that possible? Thanks, Morten -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php -- PHP General Mailing List (http://www.php.net/) To unsubscribe, visit: http://www.php.net/unsub.php