English | 简体中文 | 繁體中文 | Русский язык | Français | Español | Português | Deutsch | 日本語 | 한국어 | Italiano | بالعربية
Includere file js esterni in HTML e chiamare funzioni con parametri nel file js
1 Struttura del progetto
2 Scrivere a.js e test.html
//a.js function abc(str){ alert(str); }
//test.html <html> <head> <script type="text/javascript" src="a.js"></script> <script type="text/javascript"> window.onload = function(){ var fun = abc; //Riferimento alla funzione abc fun(123); }; </script> </head> <body> </body> </html>
3 Risultati del test
Questo è tutto il contenuto che l'editor vi ha portato su come includere file js esterni in HTML e chiamare funzioni con parametri. Spero che riceviate molto supporto e incoraggiamento dal tutorial di urla~