-1
votes
3answers
56 views

assigning js value to php

so I have this in my HTML file <script type="text/javascript" src="load.js"> </script> <script type="text/javascript" src="load2.php"> </script> Saw somewhere you ...
2
votes
3answers
91 views

Theoric topic about functions in Javascript

I decided to post this question because I've followed several tutorials online & the treat this topic in different ways. Let's say I've got a function to increment a counter: function ...
0
votes
2answers
48 views

How to input javascript variables in to html code?

I am trying to create a mileage calculator for an app, and I found the code online. <html> <head> <meta name="viewport" content="initial-scale=1.0, user-scalable=no"/> <script ...
0
votes
2answers
37 views

Variable becomes undefined during my function

I have this jQuery function: var searchResultsCounter = 0; function searchPerson(filterText){ //code $.ajax({ type: "GET", dataType:"json", url: "res/main.php", ...
1
vote
1answer
30 views

Variable range in function

I have problem with this code... How can I subtract variable global variable inside function and get it? var liczba = 0 function create(data) { liczba-- } if(e.keyCode == 32) { liczba++ ...
0
votes
5answers
55 views

Using javascript variable on html <a>

I have this javascript code: <script ="text/javascript"> var newUrl=window.location.href; var pathArray=""; pathArray=newUrl.substr(newUrl.lastIndexOf("?")+1); </script> I ...
0
votes
1answer
30 views

how to get value of variable from one function code into another function php wordpress

I have the following (very reduced code) and I want to call the value of the variable $sendmilisecs from the first function in the second function (line 7 from bottom), but every attempt failed. I ...
-1
votes
4answers
52 views

variable definition, different output

This gives correct answer: <script type="text/javascript"> var numbers=[67,56,45,34,78,54,67,90,43,56,78,90,23,45,67,89,54,1]; var sita=0; for(i=0;i<numbers.length;i++){ ...
0
votes
1answer
22 views

Global boolean not working within function - Javascript

<script> var xTurn = true; function changeImage() { element=document.getElementById('myimage') if (element.src.match("/wp-content/uploads/2013/07/squaree.png") && xTurn) { ...
0
votes
3answers
29 views

JavaScript variable value to fluctuate between two values

I'm trying to get a JS variable to fluctuate between two values over time. For example, let's say we start with var counter = 0, and every second this variable increases by one. How would I make it ...
0
votes
3answers
35 views

Declaring a temporary variable into a global variable in javascript responseText

I am trying to make xhr.responseText into a variable and then alert it but for a strange reason i cannot do so. test2 = "" function process(){ url = "http://www.example.com/example.html" var ...
0
votes
2answers
71 views

Create arrays from input in a cycle JavaScript

I am currently saving user input within an accordion into arrays. My Accordion is dynamic and on click, another accordion column with input fields is created: var i = 1 ; function ...
-3
votes
2answers
26 views

including multiple variables in multiple get variables

I have 3 variables, named a, b and c. I want to pass variables into each one of them but i'm having trouble doing so. With 1 variable and 1 get variable it's straight forward like this: var xmlhttp = ...
0
votes
2answers
58 views

Why are these variables “undefined”?

I have the folowing code : var canvasData; var canvas2imgval; imageObj1.onload = function() { ctx.drawImage(imageObj1, 0, 0, wdOb1, hgOb1); imageObj2.onload = function() { ...
0
votes
1answer
30 views

Arrays, how they are set up, and variables acting like one?

I am currently learning JavaScript from a book and codecadmey and have been having a confusing time with arrays. Both sources differ in how they set up arrays. What are the differences between ...
1
vote
2answers
28 views

JS replacing all occurences of string using variable [duplicate]

I know that str.replace(/x/g, "y")replaces all x's in the string but I want to do this function name(str,replaceWhat,replaceTo){ str.replace(/replaceWhat/g,replaceTo); } How can i use a ...
0
votes
1answer
26 views

Grails controller values (map) to separate javascript file

I have checked a lot of forums, but I haven't got my answer. So - I have a lot of JS code, so i keep it in separate .js file (not in .gsp view). But now I have problems of accessing controller mapped ...
0
votes
1answer
52 views

Javascript accessing dynamic object properties

I am a novice programmer working with OpenJScad written in Javascript to build 3D models. I am trying to figure out how to structure my code so that I can access an object's instance properties that ...
-1
votes
1answer
63 views

What's wrong with this onClick? Javascript [closed]

I've been dealing for half the day with this. My function is not working. It worked at one point and now I can't figure out how to go back. This is my HTML code <a href="#" ...
0
votes
2answers
69 views

How to pass javascript variable in jsp page to another java file?

Good Evening, I try to do a checkbox which embedded in a JSP page. I use document.getElementByID("checkbox") in the JSP javascript function. How to pass the variables in the javascript function to ...
0
votes
0answers
25 views

Variable changes after the function triggered twice

I'm simply trying to modify a chrome extension. However I don't know much about JavaScript. I'm just a reader rather than writing stuff in JavaScript. Anyway, I wrote a function that inserts a little ...
1
vote
3answers
74 views

Why does the alert coming from my loop always return the last value, not each iteration value? [duplicate]

I have a some buttons, which are stored in an array. I then loop through that array to add a click event to each button. Each click alerts the value of i. I expect the values to be 1, 2, 3 and so on, ...
0
votes
1answer
57 views

Passing variables between functions in Javascript

I have this code: collection = (function() { function collection(removeLinkTitle){ this.removeLinkTitle = removeLinkTitle || 'delete'; } collection.prototype = { ...
1
vote
1answer
60 views

Difference var foo and var $foo [duplicate]

Searched for duplicates but couldn't find any.. Is there any substantial difference between: var $foo = $(this); and var foo = $(this); ??
0
votes
1answer
28 views

js more then one Value not gate from out side in javascript

<script type="text/javascript"> var my_site = 'katzbb.com'; var ex_domains = "['phaze.co'],['katzddl.org']"; </script> and in the URL: i will add http://*/pcloud.php These Code ...
1
vote
3answers
72 views

How can I add links or color changes to a var string in JS?

So, I have a site that has a random on-load slideshow with div containers calling text for each slide. I want to be able to add links and/or color changes to specific words. Here's a JSFIDDLE link of ...
0
votes
1answer
16 views

Passing variable from JSP to Javascript

I know there is already questions about that, but I just can´t simply get this work, I have a JSP file with a java variable in it: String test = "Hello"; And I need to read this value in the ...
0
votes
1answer
38 views

JS - Can't send php to js variable [duplicate]

I'm working on gChart Organization. In PHP i able to get and echo some text from db. Here i have problem on how to pass text from db to js. In here, i have some text from db ($data[nama] and ...
0
votes
4answers
32 views

JavaScript variable split into groups

have a var id = "123456789"; how to split in into groups after each 3 digits?? result must be like this: var no1 = 123; var no2 = 456; var no3 = 789; if the id will be longer 12, 15 or more ...
0
votes
2answers
56 views

Cannot change value of dynamically created textbox

I have been trying various means of doing this all day, and nothing has done the job yet. What I have is a text box that is part of a dynamically generated HTML table... users can add rows or delete ...

1 2 3 4 5 77
15 30 50 per page