开发者

javascript file talk to script in html file

开发者 https://www.devze.com 2023-03-02 08:36 出处:网络
Is there a way of calling a function that exists in a HTML file from a .js file? Something like this: HTML file:

Is there a way of calling a function that exists in a HTML file from a .js file?

Something like this:

HTML file:

<script type="text/javascript" src="javaFile.js"></script>
<script 开发者_如何转开发type="text/javascript">
    function doSomething() {
    };
</script>

javaFile.JS file:

htmlFile.doSomething();

? Thanks :)


You can directly call doSomething();

0

精彩评论

暂无评论...
验证码 换一张
取 消