The Funelephant Forums!

You are not logged in.

Announcement

The Forums are currently Read-Only except for Mods & admin. These forums are closing down, but don't worry! We created a new forum, with more features! They are almost ready. We know it's hard to transition, but it's for the best! :D New Forums are here!

Adverts

Adverts

#1 Wednesday, July 4, 2012 07:35:50

daniel_j
From: Adelaide, Australia
Registered: Monday, July 2, 2012
Posts: 303
FunCoinz: 256
Bank: 50
Reputation :   
Website

Select Tag.

ok, so I know how to use this tag (<select>), but I am wondering is there an easier way to use it, for example here is a code I made for funelephant to change bgcolor through <select>;

Code:

<form name="bgcolorForm">Background Color: 
<select onChange="if(this.selectedIndex!=0)
document.bgColor=this.options[this.selectedIndex].value">
<option value="choose">set background color    
<option value="FFFFCC">light yellow
<option value="CCFFFF">light blue
<option value="CCFFCC">light green
<option value="CCCCCC">gray
<option value="FFFFFF">white
</select></form>

And I am wondering, can it be simplified to use a script more like;

Code:

<select>
<option>Red    
<option>Green
<option>Pink
</select>

Like, can I add set variables for when each one is clicked, eg;

Code:

<select onchange='bgcolor="FFFCC"'>

I know this should probably be on CodersShed, but I think it is too simple for there :)
Thanks for any help!
Does anyone even understand? :D

Last edited by daniel_j (Wednesday, July 4, 2012 07:37:45)


For all those wondering why, why?

Offline

 

Wednesday, July 4, 2012 07:35:50

AdBot
Advertisements

#2 Wednesday, July 4, 2012 09:28:55

SciTecCf
Outstanding Member
Registered: Sunday, July 1, 2012
Posts: 137
FunCoinz: 35
Bank: 62
Reputation :   

Re: Select Tag.

You never closed your option tags. :P

No, you cannot simplify it. The onChange parameter isn't supported by option tags. ;)


http://i1237.photobucket.com/albums/ff468/sciteccf/GrayAd.gif

Offline

 

#3 Wednesday, July 4, 2012 10:04:24

daniel_j
From: Adelaide, Australia
Registered: Monday, July 2, 2012
Posts: 303
FunCoinz: 256
Bank: 50
Reputation :   
Website

Re: Select Tag.

yeah, the <option> tag, in this case does not need to be closed, just like <p> :P
[Mild curse removed by moderator, try and refrain from saying that!], I was hoping it could be, but thanks anyway!
Dan
:)

Last edited by funelephant (Wednesday, July 4, 2012 12:45:20)


For all those wondering why, why?

Offline

 

Adverts

Board footer

Powered by FluxBB
Hosted by PunBB-Hosting