Jump to content

display text with a select


thibo1025

Recommended Posts

I nead to be able to sort text otomatikally using a select:

<select name='name' onchange='text(this)'><option></option><option value="1">something</option><option value="2">something</option></select>

what kind script should I make after this ,

<script language='javascript'>function text(x) {var x = new Array();	x[1] = "some text";	x[2] = "some text";/* What do I put here? */}</script>

in order to make the text show?

Link to comment
Share on other sites

  • 2 weeks later...

I want to do a OnChange function which displays text underneath the box.

<table border="0"><tr><td><select name="name" onchange="function_one()"><option value="0"></option><option value="1">some text</option><option value="2">some text</option><option value="3">some text</option></select></td><td><sciprt language="javascript"><!-- This is where I want a text to be dispalyed considering the value chosen form the select --></script></td></tr></table>

Now is it more clear? ( excuse me if I was not clear)

Link to comment
Share on other sites

<script language="javascript">function changeTxt(obj){where = document.getElementById("here");what = obj.options[obj.selectedIndex].text;where.innerHTML = what;}</script><table border="0"><tr><td><select name="name" onchange="changeTxt(this)"><option value="0"></option><option value="1">some text 1</option><option value="2">some text 2</option><option value="3">some text 3</option></select></td><td><div id="here"></div></td></tr></table>

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...