Файл Main.html
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 |
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd"> <html xmlns="http://www.w3.org/1999/xhtml" xml:lang="en" lang="en"> <head> <meta http-equiv="Content-Type" content="text/html; charset=utf-8" /> <title>main</title> </head> <body> <button id="mybutoon">mybutoon</button> <script src="EventHandler.js"></script> <hr> <div id="mydiv"> </div> </body> </html> |
Файл EventHandler.js
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 |
/** * @author Panteleev Stanislav */ function SaySomething(anyfunctionname) { var phrase=anyfunctionname('Aloha'); alert (phrase); } function MyTranslator(word){ if (word==='Hello') return 'Hello'; if (word='Aloha') return 'Hello'; } function Integration(){ SaySomething(MyTranslator);//<<Здесь функция внутри функции } document.getElementById('mybutoon').onclick=function(){Integration();}; |