javascript应该嵌入到html中的什么位置

DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <meta http-equiv="X-UA-Compatible" content="ie=edge">
    <title>Documenttitle>
    <style>
        input.btn {
            background: red;
        }
        .overstyle {
            background: olive;
        }
        .outstyle {
            background: red;
        }
    style>
    
    <script>
        document.write("js代码输出的文字;一般不这么用");//document.write()是文档对象的输出函数。其功能是将括号中的内容或变量值输出到页面文档中。

        //  一些比较简短的js事件代码可以直接写在html标签内,格式:  onclick=javascript:函数名称()   具体的函数写在嵌入head的js代码中
        function submit() {
            alert('提交');
        }

    script>
head>

<body onLoad="window.alert('页面内容完成导入到浏览器')">
    <input type="button" name="button" title="新建申请表单" value="新建" class="btn" onmouseover="this.className='overstyle'" onmouseout="this.className='outstyle'" onclick="javascript:submit();">

    
    <script>
        

    script>
body>
html>

 

你可能感兴趣的:(javascript应该嵌入到html中的什么位置)