Path: csiph.com!aioe.org!.POSTED!not-for-mail From: parmenides Newsgroups: comp.lang.javascript Subject: How to call another function? Date: Mon, 3 Jul 2017 14:37:04 +0800 Organization: Aioe.org NNTP Server Lines: 36 Message-ID: NNTP-Posting-Host: XvVSx2sNhFLRPV14DHpQtA.user.gioia.aioe.org Mime-Version: 1.0 Content-Type: text/plain; charset=gbk; format=flowed Content-Transfer-Encoding: 7bit X-Complaints-To: abuse@aioe.org User-Agent: Mozilla/5.0 (Windows NT 6.1; WOW64; rv:52.0) Gecko/20100101 Thunderbird/52.2.1 X-Mozilla-News-Host: news://nntp.aioe.org:119 X-Notice: Filtered by postfilter v. 0.8.2 Xref: csiph.com comp.lang.javascript:33570 Hi all, I want to call a function from another funciton in the same js file. For example, in hello.js two functions are defined as follow: // hello.js function hello() { alert("hello"); } function submit() { hello(); return true; } Then, the submit() function is called in hello.html: <--! hello.html --> Document
But, the message box doesn't pop up as expected. If the onsubmit is replaced as onsubmit="hello()" the message box can pop up. It seeems that a function can not call another function. Is it correct? How can I deal with the problem? Thanks.