IWETHEY v. 0.3.0 | TODO
1,095 registered users | 1 active user | 0 LpH | Statistics
Login | Create New User
IWETHEY Banner

Welcome to IWETHEY!

New Accessing multiple inputs with same name
I've got one form where it was more convenient to name the values of an arrayed field with the same Name and ID. Unfortunately, I also need to be able to access them individually as well. I can't seem to find the DOM technique for accessing beyond the first field. Here's the snippet that demonstrates the problem:

<html>
<head><title>Test</title></head>
<body>
   <form id='TestForm' name='TestForm'>
      <input type='text' id='TextBox' name='TextBox' value='TextBox #1' /><br />
      <input type='text' id='TextBox' name='TextBox' value='TextBox #2' /><br />
   </form>
   <script language='JavaScript'>
      document.write("TextBox #1 = " + document.getElementById("TextBox").value + "<br>");
      document.write("TextBox #2 = " + document.getElementById("TextBox").value + "<br>");
   </script>
</body>
</html>
New As long as I'm tapping the collective...
I have another DOM question, though this one is for play only. I've been considering taking a [link|http://www.bluetail.com/~luke/jscm/scm.js.txt|Scheme in JavaScript] ditty, and make some improvements. Having gotten far - the first project is to try to strip the JavaScript string-a-nation out of the scheme include files (the second has to do with building a scheme object that does the evaluation).

I can't figure out how to access an included scheme file. The browser doesn't recognize scheme as a valid script engine, but I was thinking that perhaps it does expose the included source into the DOM. Here's a snippet of what I'm trying to accomplish:

<html>
<head><title>Test</title></head>
<script language='scheme' src='library.scm' type='text/scheme'></script>
<script language='javascript' type='text/javascript'>
   // how can I get the above included script file into a JavaScript string?
</script>
<body>
</body>
</html>
New Re: As long as I'm tapping the collective...
[link|http://www.w3.org/TR/2003/REC-DOM-Level-2-HTML-20030109/html.html#ID-81598695|http://www.w3.org/TR....html#ID-81598695]
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
New You can't, directly.
Using the same ID ist verboten. :-)

You could use either document.getElementsByTagName("name") and then iterate the NodeList (list.item(0), list.item(1), etc.), or just get the first one by ID, then iterate the DOM from there (node.nextSibling(), etc.).
Regards,

-scott anderson

"Welcome to Rivendell, Mr. Anderson..."
Expand Edited by admin April 11, 2004, 05:45:53 PM EDT
Expand Edited by admin April 11, 2004, 05:50:01 PM EDT
New I've made it a habit of keeping the id & name the same
In this case, I suppose I'll have to assign unique id's and continue to use the same name for the respective inputs. Didn't realize that id names need to be unique.

Thanks.
     Accessing multiple inputs with same name - (ChrisR) - (4)
         As long as I'm tapping the collective... - (ChrisR) - (1)
             Re: As long as I'm tapping the collective... - (admin)
         You can't, directly. - (admin) - (1)
             I've made it a habit of keeping the id & name the same - (ChrisR)

The mind boggles.
92 ms