Return Styles: Pseud0ch, Terminal, Valhalla, NES, Geocities, Blue Moon.

Pages: 1-

Javascript HALP

Name: Anonymous 2012-08-16 13:30

function Getunits(){
    var units = document.getElementById('units');
    append = "";
for (count=0; count<=units; count++){
    append = document.getElementById('futureacc').innerHTML = '<input type="text" name="toprovision">';
}
    document.getElementById('futureacc').innerHTML = 'Please provide your Account Number: <input type="text" name="accountnum">';
    document.getElementById('futureacc').innerHTML = append;
}

All I want in life right now is for this script to actually go through the loop and fucking display the form field and not the nothing it currently does.


Please, for the love of whatever you love, help me.

Name: Professional JavaScript Ninja 2012-08-16 13:38

This isn't going to work; getElementById will only ever return one result so there's no point in looping. And a little later you're assigning innerHTML twice etc...

Create a http://jsfiddle.net/ with the form, write down what you want in clear English and I'll show you how it's done.

Name: Anonymous 2012-08-16 13:45

Fuck, I didn't know getElementById worked like that, give me a sec.

Name: Anonymous 2012-08-16 13:51

http://jsfiddle.net/JB2W2/

Alright, so basically: user puts in a number in the "number of units" field, and if they then want the units to be colored, they click yes, which would have an onClick command that would run that script I'm trying to make work.

What's supposed to happen is this: based on the number of units the user types in, the script generates that many fields, WHILE asking for an account number.

That's all.

Name: Anonymous 2012-08-16 14:52

tfw pro js ninja abandons you

Name: Anonymous 2012-08-16 15:19

I've reworked it to this:

function Getunits(){
    var append = "";
    var units = document.getElementById('units');
for (count=0; count<=units; count++){
    append = document.getElementById('futureacc').innerHTML = '<input type="text" name="toprovision">';
}
    document.select.value=append;
}

but it still doesn't do shit.

Name: Anonymous 2012-08-16 15:29

Name: Anonymous 2012-08-16 15:36

>>6

getElementById always returns one element

if you want to select multiple, use getElementsByClassName or TagName

Name: Anonymous 2012-08-16 15:41

>http://jsfiddle.net/aSbJm/

There's no JS in that...

And I do have a dick.

Name: Anonymous 2012-08-16 15:47

>>8

I'll use those, but now I'm wondering if that loop even does anything.

Name: Anonymous 2012-08-16 15:55

Not enough jQuery

Name: Anonymous 2012-08-16 17:16

>>11

Not enough competence is more like it.

Name: Anonymous 2012-08-16 17:59


  CC      net/core/fib_rules.o

Name: Anonymous 2012-08-16 18:10

>>1-13
Fuck off back to the imageboards

Name: Anonymous 2012-08-16 22:14

All I want in life right now is for these /g/fags to actually go back to /g/ and fucking shit up /g/ and not the shitting up of /prog/ they currently do.


Please, for the love of whatever you love, help me.

Name: Anonymous 2012-08-16 22:30

>>15
Your problem is you think everyone is from /g/.
Especially the oldest poster on /prog/ along with all the oldest posters, all of which have never actually been to /g/.
Your 2nd problem is that you are from /g/ and you need to go back there.

Name: Anonymous 2012-08-16 23:28

Use jquery

Name: Anonymous 2012-08-16 23:59

>>14
>>15

So questions can't be asked in /prog/ by people that know nothing of programing ?

Name: Anonymous 2012-08-17 1:23

>>18

The reader has no idea who the person is behind the question. They only see the question. So the question should be, "So people can't ask questions in /prog/ that show they know nothing of programming?" If this is meant to address the OP, I would say that the OP has shown that she knows something about programming, as she is able to pose a question about it. One who truly knew nothing of programming would not have the knowledge to formulate a question on it in the first place. So the question should then be, "So people can't ask questions in /prog/ that show they know only a few basics of programming and are still learning the fundamentals?" In that case, I would say that the best way to learn is to challenge yourself and ask questions. And that this applies to everyone regardless of their current level of knowledge. There is much left to be done and discovered, and none of it will happen unless we push the boundaries of what is currently known. So I would then reformulate the question as "So questions can't be asked in /prog/?" And to that I would respond, yes, of course. Anyone capable of typing a question is capable of submitting it to /prog/.

But maybe the original question was, "So questions can't be asked in /prog/ without getting edgy responses from irritable autists?" To that I would respond with the question, "Why would irritable austists prevent you from asking the question?" Maybe it wouldn't be worth the effort if every response was from an irritable autists, but as shown in this thread, there is often a mix of informative replies.

Name: Anonymous 2012-08-17 1:29

`>she
>programming

I le see what you le did there

Name: Anonymous 2012-08-17 8:46

>>1
That's the most stupid fucking code I've ever seen.

Name: Anonymous 2012-08-17 14:29

>>19
I like you.

Don't change these.
Name: Email:
Entire Thread Thread List