473,386 Members | 1,745 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

This is Crazy. Am I missing something stupid?

I have been going over the this code for hours and am baffled. Am I missing something stupid?

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
  1. function change_password(keyonetwo){
  2. alert(keyonetwo);
  3. }
Dec 16 '07 #1
2 1166
It was a stupid overview on my part. The following is how it should be quoted inside the onClick function.

"'"+php_key_object+"'"
Dec 16 '07 #2
acoder
16,027 Expert Mod 8TB
I have been going over the this code for hours and am baffled. Am I missing something stupid?
Next time just post here. See, it only took you 20 minutes to figure it out yourself! :)
Dec 17 '07 #3

Sign in to post your reply or Sign up for a free account.

Similar topics

119
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
98
by: rhat | last post by:
I heard that beta 2 now makes ASP.NET xhtml compliant. Can anyone shed some light on what this will change and it will break stuff as converting HTML to XHTML pages DO break things. see,...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.