473,397 Members | 2,056 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,397 software developers and data experts.

Dynamicly writen onClick event wont call javascript in IE

1
Hey all, ive been banging my head agains the wall for a few days now, and finally decided to ask for help. i have a document that writes the header with all the javascript in it, then modifyes a <div> tag with a button. the button has an onClick event that is supposed to call a javascript function in the header. The whole application works wonderfully in Firefox, however it seems as if IE cannot/willnot call the function. if i put an alert in the onClick event it works, however if i call a function with an alert, it does not work.

JS function im trying to call
Expand|Select|Wrap|Line Numbers
  1. function login(user, pass){
  2.     alert('Login Function');
  3.     //document.getElementById('main').innerHTML = "Processing login...";
  4.     //makeHttpRequest('validateAdminLogin.php?user='+user+'&pass='+pass);
  5. }
HTML that is Writen to a <Div> tag after the page has loaded

Expand|Select|Wrap|Line Numbers
  1. <INPUT NAME=Submit TYPE=submit id="Submit" value="Login" onClick="javascript:login(document.getElementById('userName').value, document.getElementById('passWord').value);">
Again, this works in Firfox, but not in IE

Thankyou in advance for your input.
Oct 31 '06 #1
1 6439
vee10
141 100+
hi,

the same code i have executed but it has executed in IE and i am sending the code

Expand|Select|Wrap|Line Numbers
  1. <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>
  2.  
  3. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
  4.  
  5. <html xmlns="http://www.w3.org/1999/xhtml" >
  6. <head runat="server">
  7.     <title>Untitled Page</title>
  8.     <script type="text/javascript">
  9.     function login(user, pass){
  10.     alert('Login Function');
  11.     //document.getElementById('main').innerHTML = "Processing login...";
  12.     //makeHttpRequest('validateAdminLogin.php?user='+use  r+'&pass='+pass);
  13. }
  14. </script>
  15. </head>
  16. <body>
  17.     <form id="form1" runat="server">
  18.     <div>
  19.     <input type="text" name="userName"  id ="userName"/>
  20.     <input type="text" name="passWord"  id="passWord"/>
  21.     <input name="submit" type="submit" id="submit" value="Login" onclick="javascript:login(document.getElementById('userName').value, document.getElementById('passWord').value);" />
  22.  
  23.     </div>
  24.     </form>
  25. </body>
  26. </html>
  27.  
  28.  
  29.  

Hey all, ive been banging my head agains the wall for a few days now, and finally decided to ask for help. i have a document that writes the header with all the javascript in it, then modifyes a <div> tag with a button. the button has an onClick event that is supposed to call a javascript function in the header. The whole application works wonderfully in Firefox, however it seems as if IE cannot/willnot call the function. if i put an alert in the onClick event it works, however if i call a function with an alert, it does not work.

JS function im trying to call
Expand|Select|Wrap|Line Numbers
  1. function login(user, pass){
  2.     alert('Login Function');
  3.     //document.getElementById('main').innerHTML = "Processing login...";
  4.     //makeHttpRequest('validateAdminLogin.php?user='+user+'&pass='+pass);
  5. }
HTML that is Writen to a <Div> tag after the page has loaded

Expand|Select|Wrap|Line Numbers
  1. <INPUT NAME=Submit TYPE=submit id="Submit" value="Login" onClick="javascript:login(document.getElementById('userName').value, document.getElementById('passWord').value);">
Again, this works in Firfox, but not in IE

Thankyou in advance for your input.
Oct 31 '06 #2

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

Similar topics

17
by: Mike Gratee | last post by:
Is it possible to use JavaScript to cause the browser to click a link on a page and have the browser act exactly like the user had clicked on the link directly? In other words, I need to...
8
by: KS | last post by:
Just to show some code to show the consept. <img id="date" onclick="javascript:show_calendar();" src="/PlexSysWeb/images/show-calendar.gif" width=20 height=18 border=0> What i want the...
53
by: usenet | last post by:
See <ul> <li><a name="link1" onClick="alert(this.name);return false;" href="#">Link1</a></li> <li><a name="link2" href="javascript:alert(this);">Link2</a></li> <li>Item 3</li> </ul> ...
2
by: Sedef | last post by:
Hi, i'm trying to create a custom Button user control which will be derived from System.Web.UI.WebControls.Button. the normal server side Button class creates some client side javascript code for...
1
by: Rako | last post by:
My problem is: I want to create an index to any of the available picture-groups. This index is a table of thumbs with a scrollbar. If you click on the thumb, you get the full picture displayed. ...
11
by: GaryB | last post by:
Hi Guys, I've been battling with this one for hours - I hope that you can help me! My code modifies the <aon a page, from a standard document link into a link with a tailored onclick event. ...
5
by: Stuart Shay | last post by:
Hello All I am working on ASP.NET 1.1 Custom Pager that allows a User to Enter a Number in a TextBox and go to the page selected. Since the OnClick Event does not work in ASP.NET 1.1 for a...
18
by: joaotsetsemoita | last post by:
Hello everyone, I'm having troubles assigning an onclick event to a cell. Im trying something like cursorPoint.cells.style.cursor = "hand"; cursorPoint.cells.width = "20";...
17
by: yawnmoth | last post by:
http://www.frostjedi.com/terra/scripts/demo/this-alert.html http://www.frostjedi.com/terra/scripts/demo/this-alert2.html Why, when you click in the black box, do the alert boxes say different...
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...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

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.