Closed Thread Icon

Preserved Topic: Issues with a multiple selection form Pages that link to <a href="https://ozoneasylum.com/backlink?for=18324" title="Pages that link to Preserved Topic: Issues with a multiple selection form" rel="nofollow" >Preserved Topic: Issues with a multiple selection form\

 
Author Thread
Hebedee
Paranoid (IV) Inmate

From: Maryland, USA
Insane since: Jan 2001

posted posted 08-16-2002 00:42

In the following code, i am attempting to perform the methods listed in the VALUES of the select part of the form on the click of a button. here is the code of the whole page. by the way, all of the methods listed have no errors, and i linked to them instead of showing them on the age to lessen confusion.

code:
<html>
<head>
<script src="scripts.js"></script>
<title> Javscript </title>
<script language="Javascript">

function changeit() {

for (var i=0; i<3; i++) {
if(document.f.ones.options[i].selected) {
document.f.ones.options[i].value) } }


}
</script>
</head>

<body>

<form name="f">
<textarea name="source" cols="50" rows="10"></TEXTAREA>
<select name="ones" value="sillyc" size="5" MULTIPLE>
<option value="trans()">1337 speak<option value="reversef()">Reverse<option value="allcaps(0)">All caps</select>
<input type="button" value="display results" name="go" class="gobutton" onclick="javascript:changeit()"></form>

</body>
</html>


Please help me troubleshoot.

[This message has been edited by Hebedee (edited 08-16-2002).]

Pugzly
Paranoid (IV) Inmate

From: 127.0.0.1
Insane since: Apr 2000

posted posted 08-16-2002 01:13

I can see a lot of issues with that code. What seems to be the problem that you're having?



[This message has been edited by Pugzly (edited 08-16-2002).]

someoneInverse
Bipolar (III) Inmate

From:
Insane since: May 2002

posted posted 08-16-2002 08:55

if I understand you right, I think that this little demo should do the trick for you - modify away to your hearts content

code:
<script language="javascript">
function fDoStuff()
{
var objSelecter = document.getElementById("tester");
var intSelectedIndex = objSelecter.selectedIndex;
var strFunctionToExecute = objSelecter.options[intSelectedIndex].value;

eval(strFunctionToExecute);
}

function test(intOption)
{
alert(intOption);
}

</script>

<select id="tester" onChange="fDoStuff()">
<option value="test(1)">test1</option>
<option value="test(2)">test2</option>
<option value="test(3)">test3</option>
</select>




hth
I:.

Hebedee
Paranoid (IV) Inmate

From: Maryland, USA
Insane since: Jan 2001

posted posted 08-16-2002 19:38

what i'm trying to do is to use one of those verbs or methods to perform an action on the text in the textbox. so i want the variable that is the value of one of the selections to be used as a verb. i put in the alert to make sure it was reading the selection box correctly, therefore; yes you were reading me correctly.



[This message has been edited by Hebedee (edited 08-16-2002).]

Hebedee
Paranoid (IV) Inmate

From: Maryland, USA
Insane since: Jan 2001

posted posted 08-16-2002 19:41

Thank you. That was completely effective. I did not know about the eval() function.

« BackwardsOnwards »

Show Forum Drop Down Menu