Posts by abfurlan • 10,570 points
221 posts
-
10
votes6
answers7191
viewsA: How to put default (default) arguments in a Javascript function?
There are some ways, but I prefer it this way: function func(x){ x = typeof x !== 'undefined' ? x : 10; return x; } Example…
-
1
votes2
answers1138
views -
6
votes2
answers586
viewsA: Error with CSS, bar appears where it should not
Your ul this one with margin, see: .menu ul { list-style: none; padding: 0 5px; margin:0; } Example…
-
4
votes3
answers10821
viewsA: How to delete folders, subfolders and files?
You can also use SPL Iterators Class with Recursiveiteratoriterator and Recursivedirectoryiterator available from PHP 5.3.0, see: $directory = 'hotel_emiliano'; foreach(new…
-
17
votes4
answers4178
viewsA: What is the difference between joining tables by JOIN and WHERE?
No difference, algebraically the queries are identical and will have the same performance. Your query below is written in the pattern ANSI 89 SELECT * FROM clientes c, enderecos e WHERE c.id =…
-
4
votes2
answers3257
viewsA: Login with PHP + MYSQL +MD5
Are you using the comparison operator >= (Maior ou Igual) in the stretch, mysqli_num_rows($sql) >= 0, that is, if you find the user > maior do 0, if you don’t find, Igual a 0, in this case,…
-
19
votes2
answers3841
viewsQ: Best practices for sending emails and avoiding spam
Nowadays, almost every web site or web system almost inevitably needs functionalities with sending emails, whether in contact forms, password recovery, account activation, order confirmation, etc.…
-
2
votes5
answers27365
viewsA: Remove jquery field mask
You can remove the characters on client side with jquery or in server side with PHP: Jquery: str = $("#txtCnpjPesquisa").val(); str = str.replace(/[^\d]+/g,""); PHP: $cnpj =…
-
4
votes6
answers12772
viewsA: How to locate a value in an array with a specific structure
If you need to find the value 5746 independent of the key you can make: foreach ($array as $key => $val){ if (in_array("5746", $val)){ $find = $val; } } print_r($find); Or if you need to find the…
-
0
votes2
answers297
viewsA: Script to pick tags with specific class and trigger onload
A solution using Jquery would be: $(function(){ $('img.load').attr('onload','loader(this)'); }); Demo…
javascriptanswered abfurlan 10,570 -
5
votes3
answers24936
viewsA: Last position of an Array
The function end(), makes the pointer point to the last element of the array, so if you do: $array = array('primeiro','segundo','último'); var_dump(current($array)); var_dump(end($array));…
-
2
votes1
answer1238
viewsA: I can’t line up a box in the center?
CSS does not use the center of the object as a reference for positioning, but rather the ends, so what will be in the center after this code will be the upper left corner of the object. To position…
-
1
votes3
answers1661
viewsA: Identify Urls and create links
You can use regular expressions regex, to search for combinations in the string, see: str = "Lorem ipsum dolor www.stackoverflow.com sit amet, consectetur adipiscing elit. Morbi sit amet ultricies…
-
0
votes4
answers410
viewsA: Problems sending data via _GET
If you are generating the url via jquery, you can use encodeURIComponent to pick up the values entered in the fields, it encodes the special characters.…
-
6
votes8
answers61967
viewsA: Should I use input type="Submit" or button type="Submit" in forms?
Basically what should be considered: <button type="submit"> -- conteúdo html -- </button> Using <button> gives you more layout and freedom about the button design, for example you…
-
5
votes3
answers1419
viewsA: Make Backspace when pressing "+" key
You can test the keys that are pressed with keyCode, example: $('input[type=text]').keydown(function(e) { // se a tecla pressionada for "+" if (e.keyCode == 107) { //abre o pop-up alert('abre…
-
1
votes3
answers20997
views -
2
votes5
answers501
viewsA: Hover only on some columns
You can use css only nth-last-of-type(-n+1) Would be: table tr td:not(:nth-last-of-type(-n+2)):hover{ color:red; } JS Fiddle…
-
1
votes4
answers864
viewsA: How to set Background-image with SVG hosted elsewhere
For this you can use div.style.backgroundImage='url('+imagem+')';, also remove the ';' after the 'image' variable' -> background-image:url('+imagem;+')'; var div =…
-
1
votes1
answer1168
viewsA: How to get the top edge of the div to overlap the top end of the right edge?
Using pseudo-element .caixa::after, it is possible to obtain the desired effect: .caixa{ width:100px; height:100px; border-top: 14px solid red; position: relative; } .caixa::after { content: "";…
-
3
votes4
answers37227
viewsA: Calling one function inside the other, through a string
Hello, try to do like this: function a(){ alert('olá a'); var nomeFuncao = 'b'; var b = function(){ alert('olá b'); }; var c = function(){ alert('olá c'); }; eval(nomeFuncao)(); } JS Bin You can…