basic function question
hi guys
Im not too hot on js so this script does not do exactly what i want it to.
i have a drop down form and i want it to add a value to a form area field every time its clicked on
so drop down has say two values 'one' and 'two'. if user selects 'one' the word one is added to the form area field. if user then selects 'two' from the drop down the area field will then say onetwo
at the moment my script just replace one with two or vice versa it wont leave them both there
variable is the drop down field
copy is the area field
function variable_selector() {
window.document.compose.copy.value = window.document.compose.variable.value;
return false;
}
any idea? help would be great!
Japes
timjpriebe posted this at 19:27 — 12th December 2005.
He has: 2,667 posts
Joined: Dec 2004
You need to change your = to += and that should fix it.
JP Stones posted this at 20:08 — 12th December 2005.
They have: 2,390 posts
Joined: Nov 1998
ta thats great
JP Stones posted this at 20:48 — 12th December 2005.
They have: 2,390 posts
Joined: Nov 1998
oh one more thing it includes it fine now but if i always at the end of any text in the area field
is there any way to make it go where the cursor is? that would be perfect!
Japes
timjpriebe posted this at 17:45 — 13th December 2005.
He has: 2,667 posts
Joined: Dec 2004
I think so, but honestly I've tried to figure it out in the past and have been unable to do so. Maybe someone else can be of more help...
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.