When I attach my javascript file to my html, and do a simple printing to the html upon a button press, it does nothing.
HTML code:
<html>
<header>
<link type="text/css" rel="stylesheet" href="json_stylesheet.css"/>
<script type="text/javascript" src="json_creation_functions.js"></script>
<title>UI for Curl method</title>
</header>
<body>
<form id="json_input">
<button type="button" value="Submit" onclick="post()" > Submit</button>
</form>
<div id="result"></div>
</body>
</html>
Javascript:
function post() {
document.getElementById("result").innerHTML = "Hello" ;
}
<header>
标记应为<head>
(删除er
)
Change header
to head
tag.
function post() { document.getElementById("result").innerHTML = "Hello" ; }
<form id="json_input"> <button type="button" value="Submit" onclick="post()" > Submit </button> </form> <div id="result"></div>
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.