Login Register






Thread Rating:
  • 2 Vote(s) - 3 Average


Need help here with 2 javaScript problems filter_list
Author
Message
Need help here with 2 javaScript problems #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

Reply

RE: Need help here with 2 javaScript problems #2
I fixed your nasty ass code so at least now test_id is receiving the selected option. I don't really know what you want for the "second part"... you're gonna have to explain it better if you want more help.

Code:
<html>
<script>
function test() {
    var test_id = escape(document.getElementById('test_id').value);
    alert(test_id);
    return false;
}
</script>

<form onsubmit="test()">
<select id="test_id">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" value="Submit">
</form>
</html>

Reply

RE: Need help here with 2 javaScript problems #3
(07-28-2015, 08:45 PM)Dyme Wrote: I fixed your nasty ass code so at least now test_id is receiving the selected option. I don't really know what you want for the "second part"... you're gonna have to explain it better if you want more help.

Code:
<html>
<script>
function test() {
    var test_id = escape(document.getElementById('test_id').value);
    alert(test_id);
    return false;
}
</script>

<form onsubmit="test()">
<select id="test_id">
<option value="1">1</option>
<option value="2">2</option>
</select>
<input type="submit" name="submit" value="Submit">
</form>
</html>

He means if 1 is selected, then it gives options 1a 1b, I think.

E.g.

[Image: w0Jd3SC.png]

Though, I don't know for sure, so maybe not. He wasn't very clear on that.
telegram: @satan_sl

Reply

RE: Need help here with 2 javaScript problems #4
Hi thanks for the help, here is the details

I'm using a simple form to submit two or more forms and one of the select fields are diferent.

I want the value of test_id to be assign to diferent vars

For example (The sckety scheme using countries)
test_id is 1
if test_id is 1 create a javascript var test_id1 with value USA
if test_id is 1 create a javascript var test_id2 with value 34
if test_id is 1 create a javascript var test_id3 with value 85

Then i will call the javascript vars when needed in a form using document.write(); ["+test_id+"]

Reply

RE: Need help here with 2 javaScript problems #5
Thanks i have all i need for this project

Reply

RE: Need help here with 2 javaScript problems #6
Two things:

1. I feel like we're gonna see this code in some "new" malware, shame we didnt take the opportunity to mess with it
2. How the fuck is Java, JVM, & JRE == JavaScript?
i dont know anything

Reply







Users browsing this thread: 1 Guest(s)