JavaScript and client side scripting.
Moderator: General Moderators
Jr
Forum Commoner
Posts: 99 Joined: Mon Mar 07, 2005 3:25 pm
Post
by Jr » Thu Apr 28, 2005 1:28 pm
I have an <select> <option> box that changes a maxlength 'onchange' so it uses the 'value' to determine what the maxlength should be. My problem is that i need to actually print/show the value after the form is submitted but all i can do is print
php?switch_length=nothing and that's obviously not what i want to print. Does anyone know how i can print the 'name' of the option or have two values in one option or something?
Code: Select all
print "e;<SELECT name='contact_name' ONCHANGE='location = this.optionsїthis.selectedIndex].value;'>"e;;
print "e;<option name='' VALUE='contact.php?switch_length=nothing' $select_nothing></option>"e;;
print "e;<option name='Jéréme' VALUE='contact.php?switch_length=jereme_email' $select_jereme_email>Jéréme(eMail)</option>"e;;
print "e;<option name='Jéréme(Cell)' VALUE='contact.php?switch_length=jereme_cell' $select_jereme_cell>Jéréme(Cell)</option>"e;;
print "e;<option name='Jéréme' VALUE='contact.php?switch_length=webmaster' $select_webmaster>WebMaster</option>"e;;
print "e;</select>"e;;
phpScott
DevNet Resident
Posts: 1206 Joined: Wed Oct 09, 2002 6:51 pm
Location: Keele, U.K.
Post
by phpScott » Fri Apr 29, 2005 3:35 am
when you run this bit of script what does the html look like.
you know the view->source sort of thing?
phpScott
n00b Saibot
DevNet Resident
Posts: 1452 Joined: Fri Dec 24, 2004 2:59 am
Location: Lucknow, UP, India
Contact:
Post
by n00b Saibot » Mon May 02, 2005 2:06 am
Simply
this.options[this.selectedIndex].name will give you the name of selected option.