472,780 Members | 1,336 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

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

Why doesn't document.GetElementByID("MyName").submit(); work?


I've seen lots of discussion & disagreement on this issue, so any good explanation would be appreciated.

Some people seem to think that "document.GetElementByID("MyName").submit(); should and does work. I and others have experienced that it should & doesn't work. I'll give you a little file that I tested with IE 6, FF 3, Opera & Chrome. Only the form button, document.myname.submit(); and document.forms['MyName'].submit(); worked. Take a look & let me know if I've done something wrong, or if there is a good reason that shouldn't work.



----- Code -----
[HTML]<meta http-equiv="Content-Type" content="text/html; charset=utf-8"/>
<link type="text/css" rel="stylesheet" href="MyStyleSheet.css"/>

<script language = JavaScript>
document.write("Hello World")

<FORM id="myform" name="myform" ACTION="tst.php">

<INPUT TYPE="SUBMIT" VALUE="Click for a Message Box" onclick="alert ('Button Pressed');">

<div onclick="javascript:alert('Hello!');document.myfor m.submit();"> Click Me! </div>
<div onclick="javascript:alert('Goodby!');document.GetE lementByID('myform').submit();"> <br/><br/><b>No, Me!</b><br/><br/> </div>
<div onclick="javascript:alert('It is sunny today.');document.forms['myform'].submit();"> <br/><br/><b>I say, Me!</b><br/><br/> </div>


Oct 28 '08 #1
2 3057
getElementById....it's spelled wrong....and it should work, it's a method with a return, than means assignment inside of it's own scope....

actually if you google "GetElementByID", you get a list of sites that tell you how to use it properly;)
Oct 28 '08 #2
Moving into JavaScript from a case insensitive environment.


getElementById....it's spelled wrong....and it should work, it's a method with a return, than means assignment inside of it's own scope....

actually if you google "GetElementByID", you get a list of sites that tell you how to use it properly;)
Oct 28 '08 #3

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

Similar topics

by: Ville Vainio | last post by:
I don't know if you have seen this before, but here goes: http://text.userlinux.com/white_paper.html There is a jab at Python, though, mentioning that Ruby is more "refined". -- Ville...
by: Jim Hill | last post by:
I've done some Googling around on this and it seems like creating a here document is a bit tricky with Python. Trivial via triple-quoted strings if there's no need for variable interpolation but...
by: Marc Elser | last post by:
Hi Everybody, Can someone please tell me how to access the form name if there's a form field named "name", for example: <form name="myform"> <input type="text" name="name" value="Marc">...
by: Chuck Martin | last post by:
I am having a most frustrating problem that references, web searches, and other resources are no help so far in solving. Basically, I'm trying to design a pop-up window to be called with a funciton...
by: Don | last post by:
I understand that when I send a cookie in a client-side page containing JS, it isn't actually "set" until the next page is loaded. Is there some way to "set" it within the same html/JS page so it...
by: MLH | last post by:
I have the following code to list query names in Access 2.0's Immediate Window. Currently, it lists names of all saved queries. Can you suggest a modification that will result in it listing only...
by: Vincent Finn | last post by:
Hi, I am trying to store an object in the Session() I have a VB.Net control which is loaded in an asp page and then calls a function in my webservice (also written in VB.Net) The web...
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 2 August 2023 starting at 18:00 UK time (6PM UTC+1) and finishing at about 19:15 (7.15PM) The start time is equivalent to 19:00 (7PM) in Central...
by: erikbower65 | last post by:
Using CodiumAI's pr-agent is simple and powerful. Follow these steps: 1. Install CodiumAI CLI: Ensure Node.js is installed, then run 'npm install -g codiumai' in the terminal. 2. Connect to...
by: kcodez | last post by:
As a H5 game development enthusiast, I recently wrote a very interesting little game - Toy Claw ((http://claw.kjeek.com/))。Here I will summarize and share the development experience here, and hope it...
by: Taofi | last post by:
I try to insert a new record but the error message says the number of query names and destination fields are not the same This are my field names ID, Budgeted, Actual, Status and Differences ...
by: Rina0 | last post by:
I am looking for a Python code to find the longest common subsequence of two strings. I found this blog post that describes the length of longest common subsequence problem and provides a solution in...
by: lllomh | last post by:
Define the method first this.state = { buttonBackgroundColor: 'green', isBlinking: false, // A new status is added to identify whether the button is blinking or not } autoStart=()=>{
by: lllomh | last post by:
How does React native implement an English player?
by: Mushico | last post by:
How to calculate date of retirement from date of birth
by: DJRhino | last post by:
Was curious if anyone else was having this same issue or not.... I was just Up/Down graded to windows 11 and now my access combo boxes are not acting right. With win 10 I could start typing...

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.