| | |
drop down menu call javascript function
Please support our JavaScript / DHTML / AJAX advertiser: PostgreSQL or MySQL? Compare and contrast the two most popular open source databases
Thread Solved |
•
•
Join Date: Oct 2007
Posts: 67
Reputation:
Solved Threads: 0
Hey guys,
I am trying to make a drop down menu that gives options such as (right, left, center) so that I can choose one of those and align the text in one of my layers. I am having trouble figuring out how to make this work so if someone can help me that would be great.
Basically I need a drop down menu with those three options, and when one of the options is chosen, I need it to call a javascript function onchange (i don't want to use a button, i just want to align the text instantly) and then I need the javascript function to use getElementById('mylayer') to change the alignment of the text in that layer. Can anyone help me? I'm sure it is simple and involves the values of my drop down menu, but I cannot manage to figure it out. Thanks!
I am trying to make a drop down menu that gives options such as (right, left, center) so that I can choose one of those and align the text in one of my layers. I am having trouble figuring out how to make this work so if someone can help me that would be great.
Basically I need a drop down menu with those three options, and when one of the options is chosen, I need it to call a javascript function onchange (i don't want to use a button, i just want to align the text instantly) and then I need the javascript function to use getElementById('mylayer') to change the alignment of the text in that layer. Can anyone help me? I'm sure it is simple and involves the values of my drop down menu, but I cannot manage to figure it out. Thanks!
•
•
Join Date: May 2008
Posts: 1
Reputation:
Solved Threads: 1
•
•
•
•
Hey guys,
I am trying to make a drop down menu that gives options such as (right, left, center) so that I can choose one of those and align the text in one of my layers. I am having trouble figuring out how to make this work so if someone can help me that would be great.
Basically I need a drop down menu with those three options, and when one of the options is chosen, I need it to call a javascript function onchange (i don't want to use a button, i just want to align the text instantly) and then I need the javascript function to use getElementById('mylayer') to change the alignment of the text in that layer. Can anyone help me? I'm sure it is simple and involves the values of my drop down menu, but I cannot manage to figure it out. Thanks!
html Syntax (Toggle Plain Text)
<html> <head> <script type="text/javascript"> function alignl(ele){ document.getElementById('lay').style.align=ele; } </script> </head> <body> <layer id='lay'></layer> <select id='s' name='s' onchange="alignl(this.value);"> <option value="left">left</option> <option value="right">right</option> <option value="center">center</option> <option value="top">top</option> </select> </body> </html>
Last edited by peter_budo; May 31st, 2008 at 7:27 am. Reason: Keep It Organized - please use [code] tags
![]() |
Similar Threads
- Tooltips for drop down boxes (JavaScript / DHTML / AJAX)
- Tutorial: Create a cross-browser compatible, single-level, drop-down menu (Site Layout and Usability)
- dinamic drop down menu (PHP)
- HELP with CSS/Javascript Drop down menu from Dynamic Drive (HTML and CSS)
- php drop down menu to search multiple sql tables (PHP)
- AJAX : Am i right with the concept? (JavaScript / DHTML / AJAX)
- Hijackthis report, I just don't know (Viruses, Spyware and other Nasties)
Other Threads in the JavaScript / DHTML / AJAX Forum
- Previous Thread: problem with the body and style.....
- Next Thread: multiple radiobutton values ajax problem
| Thread Tools | Search this Thread |
acid2 ajax ajaxcode ajaxhelp animate array automatically beta box bug calendar cart checkbox child class codes column cookies createrange() css cursor decimal design disablefirebug dom download dropdown editor element engine enter error events explorer ext file firefox focus form forms frameworks google gwt html htmlform ie8 iframe image() images index internet java javascript jawascriptruntimeerror jquery jsf jsfile jsp jump listbox masterpage math menu microsoft mimic mp4 object onmouseoutdivproblem onmouseover onreadystatechange parent php player post problem progressbar prototype redirect regex runtime scale scroll search select session shopping size sql text textarea toggle validation w3c web website window windowofwords windowsxp wysiwyg \n





