简体   繁体   English

codesandbox 的 JS vanila 模板不起作用

[英]JS vanila template of codesandbox not working

Attaching my code here.在这里附上我的代码。 Trying to learn JS.努力学习JS。 Practicing my code in the codesandbox.io's vanilla JS template.在 codesandbox.io 的 vanilla JS 模板中练习我的代码。

Error:错误:

这是我得到的错误

It is not reading the function that I am defining.它不是在读取我定义的 function。

CODE:代码:

<meta charset="utf-8">   

<title>BOM property</title>   
<h2>Browser Object Model (BOM) properties</h2>   

<script type="text/javascript">    

    function prpt()    

    {   

     document.write("The innerHeight is :"+window.innerHeight+"<br>"); //inner height   

     document.write("The innerWidth is :"+window.innerWidth); // inner width    

    }   

</script>      

<input type="button" value="innerHeight_Width" onclick="prpt()">      

Try to save the document with Ctrl + S keyword, and then execute the code.尝试使用 Ctrl + S 关键字保存文档,然后执行代码。

This code seems to work:这段代码似乎有效:

 <h2>Browser Object Model (BOM) properties</h2> <script type="text/javascript"> // fixed some space's function prpt() { document.write("The innerHeight is:"+window.innerHeight+"<br>"); //inner height document.write("The innerWidth is:"+window.innerWidth); // inner width } </script> <input type="button" value="innerHeight_Width" onclick="prpt()">

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM