|
-
Oct 29th, 2005, 08:19 AM
#1
Thread Starter
Lively Member
[Resolved] JavaScript: document.write in a function
Does anyone know why document.write hangs my browser with the code below. Commenting document.write out solves the problem.
Thanks,
<html>
<head>
<title>Functions</title>
<script language="JavaScript"
type="text/javascript">
function addem(){ // function defined within <head> tags
var n = 2;
var y = 3;
//alert("hi");
document.write( n + y, "<br>");
}
</script>
</head>
<body bgcolor=red>
<a href="javascript:addem()">Click here</a>
<h2>Hello</h2>
</body>
</html>
Last edited by whiteWay; Oct 29th, 2005 at 05:15 PM.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|