I am creating dynamic html via innerHTML for a webpage. There is an onClick function in this dynamic html and once the user clicks on a button change_password(php_key) is called and an alert box with the value is supposed to appear. This function has a variable, php_key, as a parameter. This variable, php_key, is passed from a php variable which is declared in the head of the document. The weird problem is that I can only get numbers to alert. If you type in any lettter for the GET value then it simply will not alert. Please see the code below. Also the gap between getElementBy and Id below is just how it is formatted on the Scripts, I have it formattd correctly in my script.
Html is below:
----------------------------------------------------------------------------
[HTML]<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<?
$update= ($_GET['update']);
?>
<script type= "text/javascript" src="scripts/addloadevent.js"></script>
<script type= "text/javascript">
addLoadEvent(change_password_html);
function change_password_html(){
var php_key= "<?echo $update?>";
var dynamic_change_password_html=document.getElementBy Id("form").innerHTML="<form id=\"change_password\">"+
"<input type=\"button\" value=\"Send\" onClick=\"change_password("+php_key+")\">";
}
</script>
</head>
<body>
<div id="form">
</div>
</body>
</html>[/HTML]
-------------------------------------------------------------------------------------------
javascript function below
--------------------------------------------------------------------------------------------
Expand|Select|Wrap|Line Numbers
- function change_password(keyonetwo){
- alert(keyonetwo);
- }