Problem With JavaScript
Posted: Tue Nov 18, 2008 8:20 pm
Hello,
I am trying to get "test" to print on the screen whenever you click a button. Like so:
Now, if i were to just replace the body with this:
It would write "Test" to the screen like i want it to. But whenever i use the first code, whenever i click the button, the entire page goes white. And nothing shows up. What am i doing wrong?
I am trying to get "test" to print on the screen whenever you click a button. Like so:
Code: Select all
<html>
<head>
<title>Test</title>
<script language="javascript">
<!--
function Test()
{
document.write("Test");
}
//-->
</script>
</head>
<body>
<?php
print('<form method="post">');
print('<input type ="button" value="Test" onclick="Test()"');
print('</form>');
?>
</body>
</html>
Code: Select all
<?php
print('<script language="javascript">Test();</script>');
?>