Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Javascript > function isn't working for some reason! =(

Reply
Thread Tools

function isn't working for some reason! =(

 
 
PrinceMhul@gmail.com
Guest
Posts: n/a
 
      09-03-2006
var objListBox = document.getElementById('catalist');
var val = objListBox[objListBox.selectedIndex].value;
var txt = dyevalue00.value;
document.getElementById(val).value = txt;

To explain real quick, this is for a character maker.
The "catalist" is a listbox with different values such as "Body1" -
"Head" - "Shoes" - "Hair" etc
"dyevalue00" is a textbox
I have many textboxes that are named the same as the "catalist" values
(like textboxes named Body1 - Head - Shoes - Hair - etc..

So whatever is selected in "CataList" (let's say Hair) I want that
textbox to equal what another textbox of mine equals. So if the
selected value on CataList is "hair", then I want the textbox that has
the id of "hair" to equal whatever is inside the textbox with the id of
"dyevalue00".

I must be doing something wrong in my code, since this is n't working.
UseNet rocks so I know someone out there will know

 
Reply With Quote
 
 
 
 
Lee
Guest
Posts: n/a
 
      09-03-2006
said:
>
>var objListBox = document.getElementById('catalist');
>var val = objListBox[objListBox.selectedIndex].value;


alert("val="+val);

>var txt = dyevalue00.value;


alert("txt="+txt);

>document.getElementById(val).value = txt;



>I must be doing something wrong in my code, since this is n't working.
>UseNet rocks so I know someone out there will know


What does "isn't working" mean? Are you getting an unexpected
value in the text box? An error message? Nothing happening?

The two alert() lines will help you to pin down whether the problem
is in finding out where to put the value, or in finding what value
to put there. Then you can look to see what's different between
the way you access the control named "catalist" and the control
named "dyevalue00".


--

 
Reply With Quote
 
 
 
 
PrinceMhul@gmail.com
Guest
Posts: n/a
 
      09-03-2006
What I mean by it isn't working is it isn't doing what I intended it to
do. Since I'm new at javascript, everything I do is trial and error.
And if I error too much, I post on here - lol.

What I really need is a way to make it so that if the selected index on
listbox1.value="text1" then I can make the textbox named "text1" (which
text1 is from the listbox.value) equal another textbox's value.

Not sure how to do that though

 
Reply With Quote
 
Evertjan.
Guest
Posts: n/a
 
      09-03-2006
wrote on 03 sep 2006 in comp.lang.javascript:

> What I mean by it isn't working is it isn't doing what I intended it to
> do. Since I'm new at javascript, everything I do is trial and error.
> And if I error too much, I post on here - lol.
>
> What I really need is a way to make it so that if the selected index on
> listbox1.value="text1" then I can make the textbox named "text1" (which
> text1 is from the listbox.value) equal another textbox's value.
>
> Not sure how to do that though


Are you anwering on something?

Please quote what you are replying to.

<http://www.safalra.com/special/googlegroupsreply/>

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
passing pointer to function - modify in different function not working Kiran C Programming 6 01-18-2007 07:04 PM
Function pointer to void function and int function Giannis Papadopoulos C Programming 5 09-05-2005 09:06 PM
How override ALL function calls? (Is there a "function call function"?) seberino@spawar.navy.mil Python 2 08-01-2005 12:38 PM
write a function such that when ever i call this function in some other function .it should give me tha data type and value of calling function parameter komal C++ 6 01-25-2005 11:13 AM
Passing a C++ object's member function to a C function expecing a function pointer! James Vanns C++ 7 01-21-2004 02:39 AM



Advertisments