1

Possible Duplicate:
How to pass parameters on onChange of html select

Been having a bit of a puzzle here. I understand that there's nothing happening on OnChange event in a option tag. But I would like to pass the value of whatever option is selected (1 to 7) into the onChange event in the select tag (in place of what I have there as '7'). What's the best way to do this?

I basically want a font size selection box. The fmtEdit function changes the size.

<select onchange="fmtEdit('Icontent','FontSize','7')">
  <option value="0" selected="true">font size</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
</select>

Thanks! gabstero

Community
  • 1
  • 1
  • 3
    Hey, I think [this question](http://stackoverflow.com/questions/5024056/how-to-pass-parameters-on-onchange-of-html-select) should answer yours. In the future, please try searching for existing questions and answers before posting a new question. – KRyan Oct 01 '12 at 19:54
  • I agree with KRyan above, but I think it is also worth mentioning that you did a good job including sufficient source and information to answer your question. – mason81 Oct 01 '12 at 21:05

1 Answers1

0

You could try the link that KRyan mentioned in the comment under the OP as that should solve your question. If you insist in doing it inline, try this.

<select onchange="fmtEdit('Icontent','FontSize',this.options[this.selectedIndex].value)">
  <option value="0" selected="true">font size</option>
  <option value="1">1</option>
  <option value="2">2</option>
  <option value="3">3</option>
  <option value="4">4</option>
  <option value="5">5</option>
  <option value="6">6</option>
  <option value="7">7</option>
</select>
Community
  • 1
  • 1
mason81
  • 1,730
  • 2
  • 18
  • 33