472,794 Members | 2,183 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,794 software developers and data experts.

simple radiogroup chambawamba


hi

i want to access the current value of this radiogroup in my
javascript function. unfortunately the id's are changing
on every request (some hash thing of pear.php.net::html_quickform-package).
Expand|Select|Wrap|Line Numbers
  1. ....
  2. <input onclick="foo();" value="0" type="radio" id="qf_18d951"
  3. name="ident" checked="checked" /><label for="qf_18d951">none</label>
  4. <input onclick="foo();" value="1" type="radio" id="qf_fd9452"
  5. name="ident" /><label for="qf_fd9452">1</label>
  6.  
  7.  
  8. <input onclick="foo();" value="2" type="radio" id="qf_a9078a"
  9. name="ident" /><label for="qf_a9078a">2</label>
  10.  
  11. ....
  12.  

here is what did _not_ work out, because i somehow dont
get a valid object in IE6 nor in a later Gecko. i am sure
i mixed something silly up, but i just cannot spot it.
Expand|Select|Wrap|Line Numbers
  1. function foo()
  2. {
  3. myobj = document.getElementByName('ident').value;
  4. myobj2 = document.getElementsByName('ident')[0].value;
  5. }
  6.  

anyone? tnx in adv!

//m


__
note: emails to reply-address end up in nirvana (spam, you know).
Jul 23 '05 #1
1 1018
Matthias H. Risse wrote:

i want to access the current value of this radiogroup in my
javascript function.
Expand|Select|Wrap|Line Numbers
  1.  ...
  2.  <input onclick="foo();" value="0" type="radio" id="qf_18d951"
  3.  name="ident" checked="checked" /><label for="qf_18d951">none</label>
  4.  <input onclick="foo();" value="1" type="radio" id="qf_fd9452"
  5.  name="ident" /><label for="qf_fd9452">1</label>
  6.  <input onclick="foo();" value="2" type="radio" id="qf_a9078a"
  7.  name="ident" /><label for="qf_a9078a">2</label>
  8.  ...
  9.  


here is what did _not_ work out, because i somehow dont
get a valid object in IE6 nor in a later Gecko. i am sure
i mixed something silly up, but i just cannot spot it.
Expand|Select|Wrap|Line Numbers
  1.  function foo()
  2.  {
  3.      myobj = document.getElementByName('ident').value;
  4.      myobj2 = document.getElementsByName('ident')[0].value;
  5.  }
  6.  


function foo(){
d=document.forms[0].elements['ident'];
for(i=0;i<d.length;i++){
if(d[i].checked){
return d[i].value
}
}
return "Not selected"
}
Mick
Jul 23 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
by: delisonews | last post by:
I'm looking for a simple, filesystem-based message board. (No MySQL!) Something that I could include easily in my code: include '../inc/messageboard.php'; .... so that the board shows up at...
3
by: Patchwork | last post by:
Hi Everyone, Please take a look at the following (simple and fun) program: //////////////////////////////////////////////////////////////////////////// ///////////// // Monster Munch, example...
7
by: abcd | last post by:
I am trying to set up client machine and investigatging which .net components are missing to run aspx page. I have a simple aspx page which just has "hello world" printed.... When I request...
14
by: Giancarlo Berenz | last post by:
Hi: Recently i write this code: class Simple { private: int value; public: int GiveMeARandom(void);
0
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...
0
linyimin
by: linyimin | last post by:
Spring Startup Analyzer generates an interactive Spring application startup report that lets you understand what contributes to the application startup time and helps to optimize it. Support for...
0
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...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Sept 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...
0
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 ...
0
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...
5
by: DJRhino | last post by:
Private Sub CboDrawingID_BeforeUpdate(Cancel As Integer) If = 310029923 Or 310030138 Or 310030152 Or 310030346 Or 310030348 Or _ 310030356 Or 310030359 Or 310030362 Or...
0
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=()=>{
0
by: lllomh | last post by:
How does React native implement an English player?

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.