Need help here with 2 javaScript problems 07-28-2015, 08:22 PM
#1
I need a HTML select box that converts into a javascript var test_id.
But i don't know where to put id="test_id" in the select code.
Example:
<script>
test = function() {
var test_id = escape(document.getElementById('test_id').value);
alert('selected');
return false;
}
</script>
<form>
<select>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" value="Submit" onclick="test">
</form>
::::::::::::The second part::::::::::::
After adding the id element
i need to convert the value 1 (test_id) into 2 or more diferent vars
Example step by step:
Selected => 1
confirms that 1 is selected
and converts into 1a and 1b (both are javascript vars) that can be call inside the javascript.
Thanks
But i don't know where to put id="test_id" in the select code.
Example:
<script>
test = function() {
var test_id = escape(document.getElementById('test_id').value);
alert('selected');
return false;
}
</script>
<form>
<select>
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" value="Submit" onclick="test">
</form>
::::::::::::The second part::::::::::::
After adding the id element
i need to convert the value 1 (test_id) into 2 or more diferent vars
Example step by step:
Selected => 1
confirms that 1 is selected
and converts into 1a and 1b (both are javascript vars) that can be call inside the javascript.
Thanks