Anyone help me to make this?
http://imgur.com/a/mRjm5#0
JS + HTML:
http://jsbin.com/ojilut/1/
Thanks Guys
Anyone help me to make this?
http://imgur.com/a/mRjm5#0
JS + HTML:
http://jsbin.com/ojilut/1/
Thanks Guys
I don’t really want to make it for you, but i don’t mind helping you.
What part are you stuck on?
function count(){
var numero = 0;
var val0 = document.getElementById("idvideo1").value;
for (var i=0;i<1;i++) {
if(eval('val'+i) != "") {
numero ++;
}
}
alert(numero);
//numero = 6 - numero;
//return numero;
//alert(numero);
}
}
function gerar() {
var cont = '';
document.getElementById("cod").value = "";
while ([b]numero[/b]--) {
cont += "Hello ";
document.getElementById("cod").value += cont;
}
document.getElementById("cod").value += cont;
}
How send the value number for function “gerar”? Thanks!
Edit:
Problem solved for now! Thanks for your availability.
I have one problem…I Have 2 variables (val1 and val2), when i insert data in two inputs (val1 and val2), alert = 2, when i insert only data in one variable don’t display any alert, nor execute the rest of the code. Whats wrong?
http://jsfiddle.net/MyNameIsJoe/shnqu/
I did other example and works good…
http://jsfiddle.net/MyNameIsJoe/L7ySS/
(in jsfiddle doesn’t work)
Hi,
I’m sorry, but I cannot reproduce your problem.
The code didn’t work in JSFiddle, but I copied it to my PC and everything works as expected.
It seems that val1
references this:
<b>name:</b> <input type="text" id="idvideo1" name="idvideo1">
and that val2
references:
<b>Favorite Color:</b> <input type="text" id="idvideo11" name="idvideo1">
If I enter “Pullo” into the name field and leave the colour field blank, I see an alert saying “1” and the following is output to the text area:
11111 Pullo 1111 1111
If I enter “Blue” into the colour field and leave the name field blank, I see an alert saying “1” and the following is output to the text area:
22222 Blue 22222 22222
If I enter both “Pullo” and “Blue” into the respective fields I see an alert saying “2” and the following is output to the text area:
11111 Pullo 1111 1111
22222 Blue 22222 22222
11111 Pullo 1111 1111
22222 Blue 22222 22222
I’m presuming that is what it should do.
Edit: I just noticed that the two input fields have the same name attribute. This is not good.