troubleshooting Question

Why isn't my onclick event working?

Avatar of NewWebDesigner
NewWebDesigner asked on
JavaScriptAJAX
5 Comments1 Solution332 ViewsLast Modified:
Why isn't my code working?

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>Untitled Document</title>
<script type="text/javascript">
body.onload = initPage;

 function initPage() {

document.getElementById("input1").onclick= insertPicture;

}

function insertPicture() {
	window.alert("hey");
}
</script>

</head>

<body>

<input type="text" id="input1" />

</body>
</html>
ASKER CERTIFIED SOLUTION
experts1

Our community of experts have been thoroughly vetted for their expertise and industry experience.

Join our community to see this answer!
Unlock 1 Answer and 5 Comments.
Start Free Trial
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros