Questions tagged as 'javascript'

4
answers

Pros and Cons of a 100% HTML / JavaScript Web Application

I'm seriously thinking of developing a web application, using only HTML / JavaScript in the client-side for performance gain and whereby any and all communication needed with the server is done through requests to a WebService (yes, it will con...
asked by 09.06.2015 / 19:08
3
answers

"Disclosure" a closure

I understand the great powers and the great consequences of closures . But suppose I have the following code ... function foo () { var x = 1; function bar () { return x++; } return bar; } ... And I do not want to...
asked by 30.01.2014 / 14:24
2
answers

Can I write in JavaScript within PHP?

Can I write the HTML tag <script> in PHP and write the script </script> using echo here? If I do for example echo("<script> var a = 'texto';</script>"); This is my code but JS does not wo...
asked by 30.09.2015 / 13:27
4
answers

What technique do you use to keep fields in a form filled or selected after $ _POST []? [duplicate]

I'm developing a real estate system and would like to ask how can I keep data for a form such as inputs , selects and checkbox selected after giving $_POST on the form. I do not know how to store this data for all...
asked by 18.11.2015 / 18:06
1
answer

Why Math.round (-0.2) returns "-0" instead of "0"

I had a problem with Javascript today that I will describe: I have a collection of values, for example: US 11.3123 Brazil -0.2291 UK 0.4501 I want to display the values without the decimal places, rounding up, and th...
asked by 26.03.2014 / 02:31
3
answers

How to switch text between "show / hide" inside a button with javascript

I do not know anything about Javascript . So even being something "simple" to some to me is a seven-headed animal. It is as follows: In the following code there is a script that I will use that hides and shows the div by clicking on the b...
asked by 05.01.2015 / 07:19
2
answers

Discover the position of the Scroll of a certain object

Is it possible to know the position of the scroll of a given object through Jquery or pure Javascript? I tried var posobj = $("#meuobjeto_id").scrollTop(); However, the value obtained is always 0. Any idea? I want the user to go through...
asked by 19.11.2014 / 19:48
2
answers

How to detect when the person starts speaking using SpeechRecognition () in Javascript

I'm using SpeechRecognition (native to every browser) to be able to do voice searches on a website and I noticed that Google can identify when the person starts talking (both in "Ok google" and when the person clicks the button To talk). I tried...
asked by 23.07.2014 / 00:06
1
answer

Remove a property from an object contained in an array

I have a variable array: Bola = []; I've added properties to it: Bola[0] = { peso:0.5, cor:"branca", marca:"nike", nota:8 }; Bola[1] = { peso:0.7, cor:"verde", marca:"adidas", nota:9 }; I would like to remove the "mark" and "weight" p...
asked by 24.03.2015 / 15:47
2
answers

Detect or block redirect with ajax?

I'm having a problem with an ajax request I'm making. The requested url is a url x , but when I make the request, it redirects me to a url y . I'm using the $.ajax function of jQuery. I would like to know if you can d...
asked by 07.12.2015 / 14:51