« first day (1684 days earlier)      last day (3279 days later) » 

user1596138
11:05 PM
@MikeM. could you try to make an example in jsfiddle? Please don't set off the infinite loop tho :P
 
hello all i have been banned for asking questions. can any body help me to remove that ban or tell me the process. at the starting when i have joined stackoverflow i dont know about ban rules so please help me.
 
well it's dynamic loaded content using an api so it's hard to do so xD
let me try to make it hardcoded
 
hey guys, I'm trying to override the onclick feature of an anchor tag and I want the zero based index of the tag to be returned when a user clicks on the link. so far I have this: function registerHandlers() {
var as = document.getElementsByTagName('a');
for (i = as.length; i-- >= 0;) {
as[i].onclick = function() {
alert(i);
return false;
}
}
}
 
@foadster Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
@foadster Welcome to the JavaScript chat! Please review the room pseudo-rules. Please don't ask if you can ask or if anyone's around; just ask your question, and if anyone's free and interested they'll help.
 
so if I have 3 links
<a href="www.yahoo.com">yahoo</a>
<a href="www.msn.com">msn</a>
<a href="www.google.com">google</a>

clicking on google would return '2'
 
11:12 PM
and it always output the eindex of the last element?
 
no, the one you clicked on.
 
I can;t even get a function to work on jsfiddle -.-
 
@MikeM. me too lol.
 
that's yours, foadster. It always outputs -1 becuae of the problem i mentioned.
 
@Luggage which problem did you mention?
 
11:17 PM
always outputing the same index.
 
i dont get why it does
 
your 'i' variable in the loops always retains it's last value when the onclick handler eventually fires.
 
oh
 
that stack overflow link talks about 'why'
 
i see
so what's the solution?
 
11:22 PM
also in the same link
 
they are logging to the console, I want to store the value and display it later
 
@SterlingArcher java is easy so far. No real hurdles, but definitely some bumps.
 
I can;t get it to work in jsfiddle as I use an api which can delays the processbar
 
what I have is:
10 progressbars
they count from 0->9
I receive from the server a count of 10
so to origional count [starting from 0] would be servercount - 1 (is 9)
Then I need to loop over it but the next progressbar is only allowed to run if the previous progressbar is on 100%
 
11:27 PM
man i need to improve my javascript. have no experience in it. luggage do you mind explaining why that works. seems like you are using a function
 
If you use a for loop then it will either run to fast, don't run other progressbars at all or if I set the counter back, the whole page is running SLOOOW
 
you are passing the value to a new function
 
An IIFE. Immediately Invoked Function Expression
Javascript scopes variable to the function, so if you want that i to stay, you need to capture it in a function. So I make a function just to call it right after.
the SO link above goes into a lot more detail than I plan to at the moment, though.
 
no worries, i get it now
luggage are you a front end dev?
 
How do I display dynamic content efficiently with JS? I have to make JS put together markup with values from an array with embedded objects. Onclick JS must put together the next category on the same page. They want it on just one page jsfiddle.net/uL38cbfn
It's a quiz actually. It has 5 questions per page and 5 possible options per every questionthe array structure is like this {categories : [ {category:1, questions: [], answers: [] }, {.. same stuff .} ] }
 
11:42 PM
I fixed it
ugly way but using 2 loops...
works fine - 1) to run the actual progress update - 2) which run after 1000 milisecond to check if one or more progressbars is not on 100%
 
are there any online tools I can use to test a javascript function?
ie. pass parameters into it and check output
 
use the Chrome console
 
How can I test this
 
just copy/paste into the console
you don't want to assign the prototype function from inside the constructor
 
11:52 PM
this is a code snippet i was given
im supposed to fix it
i dont get why the hell they are putting that prototype shit in there
 
Perhaps they want to see if you move it outside
 
I am new to JS, so all of this is confusing to me
i'm a c#/python guy
 
I am a php guy xD
 
@MikeM. :-(
 
@JanDvorak Why the sad face?
 
11:59 PM
PHP is the only language that was evolved, not designed.
 
and the sad face is for?
 
for you are using PHP
 

« first day (1684 days earlier)      last day (3279 days later) »