初期化関数が定義されているときだけ JavaScript を実行する
初期化関数が定義されているときだけ実行したい。こんなんでいいかな。
<html> <head> <script> function init() { alert('initialized'); } </script> </head> <body onload="if (typeof(init) == 'function') { init(); }"> <b>テスト</b>です。 </body> </html>
初期化関数が定義されているときだけ実行したい。こんなんでいいかな。
<html> <head> <script> function init() { alert('initialized'); } </script> </head> <body onload="if (typeof(init) == 'function') { init(); }"> <b>テスト</b>です。 </body> </html>