Jump to content

Recommended Posts

Here's what I have.  I can't get it to work for anything in the world...

 

Static or Random?
<select name="staticrand" id"staticrand" onchange="enableTextbox()">
<option value="static">Static</option>
<option value="rand" selected="selected">Random</option>
</select>

Static ID
<input type="text" value="0" name="staticid" id="staticid" maxlength="3" disabled="true" />

<script type = "text/javascript">
function enableTextbox() {
var val = document.getElementById("staticrand").selectedIndex;
if (val == 'static') { document.getElementById("staticid").disabled = false}
else { document.getElementById("staticid").disabled = true}
}
</script>

okay number 1 error that i see, if you copied pasted this code, is that you are missing an equal sign in your id, this line

<select name="staticrand" id"staticrand" onchange="enableTextbox()">

needs to be

<select name="staticrand" id="staticrand" onchange="enableTextbox()">

in order for any part of your code to work, also, you need to add a couple of lines to correctly execute your code. try

Static or Random?
<select name="staticrand" id="staticrand" onchange="enableTextbox()">
<option value="static">Static</option>
<option value="rand" selected="selected">Random</option>
</select>

Static ID
<input type="text" value="0" name="staticid" id="staticid" maxlength="3" disabled="true" />

<script type = "text/javascript">
function enableTextbox() {
var val = document.getElementById("staticrand").selectedIndex;
var op = document.getElementById("staticrand").options;
if (op[val].text == 'static') { document.getElementById("staticid").disabled = false}
else { document.getElementById("staticid").disabled = true}
}
</script>

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.