1
vote
1answer
35 views

Difference Between Real calculation number and the one i calculate with javascript function

This is the function that I write for exponentiation like the Math.pow function in JavaScript. Code: function tavan(){ var adad=document.getElementById("pain").value; var ...
0
votes
5answers
59 views

How to pass the img src into the Bootstrap modal?

Now that I'm getting all the src of the images in the loop. My problem now is that I can't pass it through the modal to show the right image. As a matter of fact, I can't show any image. Here's the ...
0
votes
0answers
20 views

Could someone please explain this code [duplicate]

I am working on a hang-man game. This function should return the new display with proper "-"s replaced with the letter guessed: function getLetter(word,letter,display){ if (word == null){ ...
1
vote
1answer
41 views

iMacros javascript loop on condition

The task is to change proxy, open a site (for example youtube.com), check if the logo is present. If there is no logo, than do it once again (change proxy and open youtube.com). If the logo is ...
0
votes
4answers
37 views

using a for loop rather than a large if statement to append info via jQuery

I have a table named bike_main with the columns "time" and "id", I use this table to get the busiest hour using mySQL MySQL $query = 'SELECT hour(date) AS h FROM bike_main GROUP BY h ORDER BY ...
0
votes
0answers
21 views

Outputting most recent messages, file reading - Javascript

var count = reader.result.match(/(\]\sERROR\s\[)/g); // Checks to see if there does exist an ERROR message in the log file if (count === null) { document.getElementById("writeHere").innerHTML += ...
0
votes
4answers
32 views

Moving an image up the screen using do and while loops

I am learning JavaScript and have been developing a simple game that is essentially a balloon that you can move around on the screen. I managed to do keypresses etc with a lot of help and the balloon ...
0
votes
2answers
55 views

Writing onto HTML page

So for a brief context, my program reads in a file and displays it onto the html page. The code below uses a regex expression to read that file and extract the errors. Instead of using console.log ...
0
votes
2answers
55 views

Can only post first result of while loop

I am using a while loop to display results from a query. The while loop is working fine. In hidden fields I would like to post the values of userID and accessID to the user details page. I am ...
0
votes
1answer
41 views

How To Fade Out Function With No Unique ID/Class

I don't normally post my server side code but I guess I can post abit to solve this issue,I have a staff page that loops through in a database as I am going to use the database to do other things like ...
0
votes
2answers
61 views

if else statement in while loop, where if else statement determines when while loop stops

var userInput = prompt("type something with or without double spacing"); var errorSpaces = []; var maxSpaceCount = []; var doneOnce = 0; var done = 0; var size; var tempArray = [0, 0]; while (done === ...
0
votes
1answer
62 views

Why is this delayed WHILE loop causing a massive memory leak?

I ripped a nice trick from somewhere else on this site that allows you to delay the cycles of a loop. I modified it a little for my own use with a Javascript bot that runs on TamperMonkey, in Chrome ...
0
votes
0answers
22 views

Generating a Series of Tables within Tables within JavaScript

I am an obvious noob, but I have a fair bit of experience in PHP and HTML and I'm trying to use JavaScript to do a task that I for which I would usually use PHP (I am quite new to JS). I am trying to ...
0
votes
3answers
177 views

Check for class in element in while loop in javascript

*This has to be done in javascript, not jQuery. What I'm trying to do is grab the innerText of the h4 tag when <a> with the class btn-blue is clicked. I realize that I could do: ...
0
votes
1answer
64 views

onClick event in an echo while loop

I am trying to have an onClick event to open each instance of the edit link that links to the specific ID in my database so that you can just click to open a new window edit what you have to and not ...
2
votes
1answer
69 views

Javascript Loan Calculator with While loop

The program is supposed to determine how many months it will take to pay off the loan. Cannot seem to figure out how to fix my mathematical calculations. Not sure if it's the while loop that's wrong. ...
0
votes
2answers
53 views

I want to sum the looped textbox

Hi guys I am new to javascript and php and I have a problem I'd like to sum the looped text box but I am lack at logics here is the code <form name="rec" action="this.php" method="post" > ...
0
votes
1answer
35 views

I want to sum the looped name in textboxt in html using javascript

I guys I am New to php and javascript and I have a problem I want to loop the name inside the textbox < form name ="rec" action="this.php" method="post" > < ?php x=0; while(x ...
-1
votes
2answers
37 views

js loop and selecting other input than clicked

I struggle with some task. When I focus on input, the value of other inputs should be cleared. Unfortunately my logic inside the loop fails. Why? *EDITED (Rocket Hazmat tip) function ...
0
votes
3answers
76 views

how to loop all data on JSON

Hi I tried Looping my json_encode() to get all data that are related based on my query the script is working fine but not the looping part here's what I have so far: $con3 = new PDO("mysql:host=". ...
0
votes
3answers
29 views

Trouble with simple While and For loop

I am having some trouble with the below sample of code, please bear with me, still a beginner var currentGen = 1; var totalGen = 19; var totalMW = 0; totalMW = 62; while (currentGen <= 4){ //Add ...
-1
votes
2answers
59 views

Trouble with a simple while loop

I'm sorry to be the one to ask a trivial question, I don't like wasting anyone's time. I'm new in the Javascript game and I'm trying to crash course myself in before I start up in school again. I ...
0
votes
3answers
36 views

Why does this javascript loop return infinitely?

Can someone please explain to me why the following code returns an infinite loop rather than redefining foo? var foo = 2; while (foo = 2) { foo = 3; } console.log('foo is ' + foo); Of course, ...
0
votes
2answers
97 views

IF statement in a while loop not working, Where am I going wrong?

So am still learning Javascript and trying to find my way. I'm trying to get something working that will save me hours of time per week at work. It's a script for a googlespread sheet. It's meant to ...
3
votes
2answers
48 views

Div value increment javascript

I am trying to make a div with an animated value increasing up to it's final value. Here's an example from themeforest: http://demo.themesvision.com/drupal/evolve/ (Happy customer, projects completed, ...
1
vote
2answers
71 views

Why does this cause an infinite while loop?

I'm completely new to coding and have started learning JavaScript recently. I don't understand why the following code causes an infinite loop. Why does the birthday(myAge) function not work within the ...
1
vote
0answers
91 views

Bash Loop on JSON Array

Context: My goal is to pull the tag from a series of git repos and merge it into an existing JSON (that is the satis.JSON file for a private repo). Example Data { "name": "Example", ...
0
votes
2answers
84 views

How do I ask a user if they want to play the game again?

I want to ask the user if they want to play the game again at the end only if they guess correctly. If they say no I want to end the program. So basically yes-> play again and no->end program ...
0
votes
1answer
93 views

Javascript function in a while loop

This is quite a difficult problem to explain, but it probably comes from a misunderstanding of how javascript works with objects: I'm trying to build a list of points over a period of several years: ...
1
vote
3answers
59 views

input.value=<variable> returning static value [Javascript]

I'm very new to this, and have recently made a very primitive program that will calculate x^y for integer values of x and y. The script var total = 1; var power = 0; var x = 4; var y = 2; ...
0
votes
2answers
30 views

why this while loop exit but execute the inside code?

I got this code working properly if I enter a number, whenever I enter the string "end" it should get out the while loop without executing the code. But if I enter "end" I get total: NaN ended , ...
4
votes
1answer
91 views

How can one protect against while(true) loops in javascript?

I have been working with teaching kids programming in Javascript using a combination of online and self made environment. At some stage most of the kids encounter a time when they create an ...
0
votes
4answers
45 views

How do I properly nest while and for loops in javascript

Just learning javascript and having a hard time with this code would like to make it repeat 5 times different random math questions but only continue to the next question if answered correctly. can ...
1
vote
3answers
272 views

Javascript Array Push Inside While Pop Loop

I've made this jsfiddle and I can't explain why the following doesn't result in an array of 5 objects all with different id properties: var arr = ["1", "2", "3", "4", "5"]; var clone = {"id": "0", ...
0
votes
7answers
71 views

What does while(i--) mean in javascript?

I'm using swipejs from swipejs.com, the home page slider uses this logic to highlight the active un-ordered list element and I'd like to know how this while condition works. <ul id="bullets"> ...
1
vote
3answers
53 views

Pausing during a loop in JavaScript

I am wondering how to make this if loop pause once every second before continuing to count the amount of "candy" I have. Edit: I want to pause so that every second the amount of candy I have goes up ...
0
votes
3answers
84 views

How to run continuous loop in javascript

while(userInput!= -1) { var total=0.0; var totalEarnings=0; var item; //var userInput; var salesPerson=1; var userInput= parseInt(prompt("outsidePlease enter ...
0
votes
0answers
50 views

Cannot read property '0' of undefined in loops

I am trying to create a loop to find a parent element and I keep getting the error 'Cannot read property '0' of undefined' I have tried using different kinds of loops, but to no success. When I ...
0
votes
1answer
36 views

Coffescript Callbacks & Functions

I have this function and I am trying to use two large functions made up of smaller ones and one while loops. One for when it's the players turn, one when it's the opponent's turn, and a while loop ...
5
votes
6answers
112 views

While loop, extra loop even though condition is false

I'm using javascript, but I'm looking for a general purpose solution that might apply to multiple languages. I want to have a while loop that runs one time longer than it's supposed to. For instance ...
0
votes
0answers
208 views

Chrome update breaks site. Maybe Salvattore?

the latest Chrome update breaks this site: katie-scott.com. It works properly in Safari and Firefox but none of the content loads in Chrome 33.0.1750.117 (I think it last worked in version 31). I have ...
0
votes
3answers
115 views

Javascript while undefined

I have a function that, among other things, grabs a data attribute from an element and uses it for some calculations. The problem is that the attribute is assigned only once the element's background ...
3
votes
1answer
74 views

Chrome DevTools: what's this arrow(<-) meaning?

I am confuse about this symbol (<-) in Chrome DevTools It's return value or console value? When I run this while loop var i = 0; while (i < 5) { console.log(i); i++; } the console ...
0
votes
0answers
424 views

Javascriopt add table rows + PHP (loop) & Mysql

I have a script which add new table rows by javascript: The script which i have used can be found here: http://viralpatel.net/blogs/dynamically-add-remove-rows-in-html-table-using-javascript/ The ...
1
vote
2answers
71 views

Javascript MVC app - Coding a “while” condition with callbacks

I am struggling to find a nice logical way of representing this pseudocode in javascript with async calls: This is controller pseudo code: // get the data for the main page, server will return ...
0
votes
1answer
53 views

Javascript onmouseover trouble switching between img

my code works, but only changes the image of the first icon when moused over. Anytime you mouse over the second or third icon, the first image is still the only one that changes. The javascript that ...
3
votes
8answers
71 views

What is the functionality of the while loop inside the if statement? JavaScript

Below is a function that returns the prime factors of a given number in JavaScript. I did not write the function but have been studying it to extend my programming knowledge. My questions are about ...
0
votes
2answers
83 views

Why am I infinitely looping and not doing anything on the webpage?

var link; link ="CODE:"; link +="URL GOTO=http://tppcrpg.net/map.php?Map=11"; iimPlay(link); var isFull; isFull = false; while(!isFull) { var macro; macro ="CODE:"; macro +="SET ...
0
votes
1answer
64 views

Online db listing [closed]

Need help Writing a list. <div id="ul"> <li></li> </div>
-1
votes
1answer
62 views

open specific div associated with a reply link which is in a while loop

Show Hide div code: <script type="text/javascript"> $(document).ready(function(){ $(".slidingDiv").hide(); $(".show_hide").show(); $('.show_hide').click(function(){ ...