вызов функции из подключенного скрипта
Я подключил скрипт
вот так <script type="text/javascript" src="/js/interface.js"></script> В этом скрипте прописал функцию function inputupload () { alert('inputupload') } А далее в теле файла продолжаю js код <script> inputupload () </script> Скажите почему я получаю ошибку ReferenceError: inputupload is not defined inputupload () |
убрав в подключенном скрипте
$(document).ready(function() {}) функция стала запускаться, но как ее запустить с $(document).ready в скрипте |
Цитата:
tmp.html <!DOCTYPE html> <html> <head> <script src='http://code.jquery.com/jquery-latest.js'></script> <script src='tmp.js'></script> <!-- <link rel='stylesheet type=text/css href=tmp.css' /> --> <style type='text/css'> </style> <script type='text/javascript'> $(function (){ inputupload(); }); </script> </head> <body> </body> </html> </html> tmp.js function inputupload () { alert('inputupload') } Таки работает! :) |
Часовой пояс GMT +3, время: 15:38. |