Posts by Laerte • 22,243 points
249 posts
-
2
votes1
answer627
viewsA: How to save information to an array?
//Criando o Array vetor do tipo String com seis posições String funcionarios[][] = new String[5][1]; You should now create a matrix with 5 rows and two columns (name and position) and not a matrix…
-
3
votes1
answer2613
viewsA: Get Inputs with type="money"
Just use the selector: [type=money] $(function() { $('[type=money]').maskMoney({ thousands: '.', decimal: ',' }); }) <script…
-
0
votes2
answers86
viewsA: Inserting a string into a list of ints
Syntaxerror: can’t assign to Function call This error is happening because you are trying to assign a value in a function call. Ex: newlist.append(item) ='fizzbuzz' You are trying to assign a value…
-
2
votes1
answer15259
viewsA: Run a.js file
Directly accessing a Javascript file (.js) does not cause it to run. You can create an HTML page and include the path to your script. Ex: <script src="index.js"></script> You can also…
-
6
votes1
answer3135
viewsA: Allow only numbers in an input
Using this function below you limit the keys that the user can type, in your case: numbers, sign (-) and point ( . ) var filtroTeclas = function(event) { return ((event.charCode >= 48 &&…
javascriptanswered Laerte 22,243 -
1
votes2
answers747
viewsA: How to prevent iframe from being redirected to the beginning
Based on this structure I suggest using sessionStorage to store Urls. You can have a JS that will be on all pages that are within the frame and that you want to save: var els =…
-
1
votes1
answer83
viewsA: Get id attribute number in <img> tag within while cycle
Just pass the element as parameter for the method: function showId(el) { alert(el.id); } <img src="http://aux.iconpedia.net/uploads/iphone-bk-icon-64.png" id="um" onclick="showId(this);">…
-
3
votes1
answer40
viewsA: Lacos while em javascript
Just create a condition: var loop = function(x) { qtd = 0; while (qtd < x) { console.log("Mensagem #" + qtd); qtd++; } } loop(10);…
javascriptanswered Laerte 22,243 -
1
votes2
answers365
viewsA: Add attribute to dynamically created object
By code I believe that the number of items in the endpoint array is equal to the number of classes and that you intend to assign these values in the endpoints with the class .letras, the method…
-
2
votes2
answers65
viewsA: How to mount this SQL
You have the id_municipio to identify the client’s municipality, just make a link to the table regional_municipio and make Count! I believe this SQL solves your problem. SELECT COUNT(c.id) FROM…
-
7
votes1
answer122
viewsA: two different Patterns in the same HTML input
Cannot add more than one regex to the Pattern attribute, what can be done is to add a group containing what you want. <input type='text' pattern='[A-Za-z0-9._%+-]+@(gmail|hotmail).com'>…
-
2
votes2
answers678
viewsA: Is it possible to definitely change the style of a CSS class using Javascript?
The only way to change the style of an element is to override or add a new rule in a style tag, as shown below: var flag = false; // flag para controle $("#mudarcss").click(function() { if (!flag) {…
-
3
votes2
answers2659
viewsA: Getting "is not a Function" error for a declared function
You can also use the this and call the external function even having the same name. (function () { function abc() { var xyz = this.xyz(); } function xyz() { console.log(123); } abc(); })();…
javascriptanswered Laerte 22,243 -
3
votes1
answer325
viewsA: Use more than one variable in the same sentence(replace)
From what I read you want to replace: Mr(a) V1, the value of your invoice is V2 real. But in the code you’re giving replace in v1 (minuscule). String mensagemI = "Sr(a) V1, o valor da sua fatura é…
-
1
votes1
answer254
viewsA: Active class in the menu using include in Asp
You can add this JS at the end of this page that you are giving a include: url = document.location.pathname.substr(document.location.pathname.lastIndexOf("/") + 1); // Pega o nome da página atual,…
-
2
votes2
answers4318
viewsA: Change color CSS
If only to change in div 2 you could use the event :hover of the CSS. $("#dois").on("mouseover", function() { $("#um").css("background-color", "red"); $("#dois").css("background-color", "red"); });…
-
4
votes3
answers1458
viewsA: Javascript - Line break in file . txt
Just use the split function it returns an array. var txt = "Essa é a linha 1\nEssa é a linha 2\nEssa é a linha 3"; var vetor = txt.split("\n"); vetor.forEach(function(x) { console.log(x) } );…
-
11
votes2
answers113
viewsA: Is it possible to access the same argument twice in sprintf?
According to the function documentation sprintf, you must use the character $ preceded by a number, which represents the number of the argument you want to capture, and preceded by the desired…
-
4
votes1
answer628
viewsA: How to protect me from this PHP backdoor?
About your problem take a look if there is any area or script that accepts upload as it may be from there that the shell has been uploaded. The \x is encondig ASCII in hexadecimal notation. I…
-
3
votes2
answers574
viewsA: How to get meta tag information from an external url?
Due to CORS restriction (Cross-Origin Resource Sharing, read about here), browsers block by default requests outside your domain. But we can use a proxy like crossorigin.me to perform this type of…
-
8
votes2
answers2015
viewsA: Simple equation of division in java
( 90 / 112 ) is a division of integers. Java makes the cast for double that shoots down (0) due to the result: 0.8035... when multiplication is done: 0 x 100 = 0. You can cast at least one of the…
-
2
votes2
answers52
viewsA: Case sensitive in the form method?
Not. Attributes are not case-sensitive.
-
4
votes1
answer419
viewsA: How to know which network a video belongs to?
I can’t tell you if the API has this information but one way to get it is through the meta tag attribution that has the information of which network the channel is part of. To recover this…
-
2
votes1
answer611
viewsA: Rename the button
You can add a new parameter and pass the field using the this: HTML: <!-- código omitido --> <td> <input type="button" id="salvar" name="salvar" <?php echo…
-
3
votes2
answers72
viewsA: How to trigger functions outside the scope of the Plugin?
Without using the method on, assigning the event using attribute onclick of input. (function($) { $.fn.foo = function(options) { var opts = $.extend({}, $.fn.foo.defaults, options); this.init =…
-
4
votes1
answer238
viewsA: Eval() PHP, usability and context
val - Runs a string as PHP code. In the case of the code posted, they are using the ASCII encondig in the hexa-decimal notation, below I added the initial code and ran the Alert function to see…
-
6
votes1
answer17867
viewsA: Response to preflight request doesn’t pass access control check
Web browsers have a security restriction, called Same Origin Policy. It makes certain requests, such as those made via Ajax, only allowed within the same domain. The recommended solution is to use…
-
4
votes3
answers1646
viewsA: Java Maps: take key from value
There is no official method to retrieve the key from the value, but you can implement: public static <T, E> T getKeyByValue(Map<T, E> map, E value) { for (Entry<T, E> entry :…
-
3
votes2
answers1331
viewsA: HTTPS server consults postal zip code
When you use the HTTPS protocol and need to make requests they must be via HTTPS. For security reasons. In your case your server is using HTTPS but the Mail Web Service does not, so it does not…
-
4
votes2
answers5307
viewsA: How to disable checkbox without using disabled?
Not using the default property disabled you can put a onclick. This happens because when using return false stop the click event that changes the checkbox value. <input type="checkbox"…
-
1
votes1
answer792
viewsA: Insert elements using Javascript insertBefore
The function getElementsByClassName returns a list of elements that have a certain class. So for your code to work you must specify the element index, as in this scenario there is only one element…
-
1
votes3
answers1406
viewsA: How to change a value of a variable inside an if in java?
This happens because you are trying to assign a type without instance it. Declare the variable outside and create an instance within the condition. Jogador Player2; if (menu == 1) { Player2 = new…
-
4
votes1
answer114
viewsA: Format query to send to Viewbag
Do you want to return only the value of the right Year? The way you did you return an anonymous object so when you use the .toString() it comes with the keys, you can change your query to return the…
-
1
votes1
answer66
viewsA: Problem with SUM in Namedquery
You can create a builder on Controle or in a new class that receives the values you are returning. Ex.: new Controle(Prestador pre, TipoPrestador tp, Float valorLote, Float valorPago, ... // resto…
-
3
votes2
answers1158
viewsA: Why does the download attribute not work?
I believe it is incompatibility of your browser, as mentioned by @Guilherme, a simple javascript can show if your browser supports this attribute. alert(("download" in document.createElement("a") ?…
-
5
votes2
answers1401
viewsA: How to mount a SELECT with ordered nonexistent numeric column
Use the function row_number() SELECT descricao_produto, preco, row_number() OVER (ORDER BY descricao_produto) AS ordem FROM produtos;…
-
0
votes1
answer95
viewsA: Export data from an array to a table on the same page using a javascript function?
Do you want to pass the values of txts to the correct table? See the example below (da para salvar num array, but since the question is only to pass the information, I did not implement. function…
-
1
votes3
answers897
viewsA: Search - Show Message if results are not found
I added ID in tfoot and created a flag that receives the amount of records from the table and subtracted every time you hide an item, if at the end the flag value is 0 I show the message. var table…
-
2
votes1
answer1042
viewsA: Receive URL parameters by JS (jQuery)
How do you want the value after the last bar, using the location.href and the lastIndexOf function that returns index of the last position of the value that was passed in this case to /. + 1…
-
2
votes1
answer1180
viewsA: SQL - Update without losing values
Using the CONCAT function you achieve this. UPDATE Clientes SET frase = CONCAT(frase, 'dia') WHERE nome='lucas'; Functional example here.…
-
2
votes3
answers630
viewsA: Indications of use of cookies?
Cookies are usually used to save preferences (style sheet, usage data, number of accesses, frequency, etc). At the beginning of Orkut only with the user cookie you could access the account without…
-
4
votes1
answer2513
viewsA: Get Absolutepath from input type="file"
Is not possible. For security measure browsers do not allow you to know the Absolute Path of the user file. And you can only view the previous folder name because the property webkitdirectory…
-
2
votes1
answer155
viewsA: Solution/alternative to obsolete eregi_replace
Replace with preg_replace and take the test. $_pagi_sqlConta = preg_replace("/select[[:space:]]'\(.*\)'[[:space:]]from/", "SELECT COUNT(*) FROM", $_pagi_sql);…
-
1
votes3
answers4496
viewsA: onchange Select does not work - jQuery
The event .onchange is working properly. It is being assigned on line 91 of the file cidadesEstados.js this.estado.onchange= function() { this.dgCidadesEstados.run() }; In HTML you try to assign the…
-
6
votes1
answer179
viewsQ: What are digraphs in C?
Based on the question of graphs, what are digraphs? Why were they created? What are the sequences? Current compilers still allow you to use them?…
-
16
votes2
answers2975
viewsA: Is it possible to create an input uppercase and keep the placeholder in lowercase only in CSS?
Since it is a property of CSS3 each browser has implemented in a way this selector, then you have to use the prefix vendor. input { text-transform: uppercase; } ::-webkit-input-placeholder { /*…
-
1
votes3
answers1396
viewsA: Check that the mouse is not in the element
There is a library called jQuery Outside Events that implements "outside" events that are executed when event occurs outside the element in question. These are the events "from outside":…
-
3
votes1
answer178
viewsA: Javascript set value of one field in others
In Web Forms the default ID is generated dynamically. Change the property Clientidmode for Static for this not to occur and remain the ID you have set. <asp:TextBox runat="server" ID="NuJaneiro"…
-
3
votes5
answers1294
viewsA: change the title of a Window confirm()
It is not possible, the alternative would be to use some kind of modal. This limitation is for security reasons, a malicious person could change the URL shown in the confirmation window for example.…
-
3
votes1
answer1329
viewsA: How to get every day of a month using Javascript?
I implemented something very fast for you to have an idea, from this you can popular your select of Year/Month, the function receives the month and the year. In this example I used the month of…
javascriptanswered Laerte 22,243