Posts by MarceloBoni • 6,385 points
228 posts
-
0
votes0
answers766
viewsQ: Trigger to update a field automatically after Insert
I have a user table, basically: CREATE TABLE IF NOT EXISTS `sistema`.`user` ( `id_user` INT NOT NULL AUTO_INCREMENT COMMENT '', `hashed_id` VARCHAR(40) NOT NULL COMMENT '', `nome` VARCHAR(40) NOT…
-
0
votes1
answer753
viewsQ: Lock form query into ajax request
I have the following code: jQuery('#modal').on('submit', function(e) { jQuery('button[type="submit"]').prop('disabled', false); jQuery('div[name="loading"]').html("<i class='fa fa-circle-o-notch…
-
0
votes1
answer963
viewsQ: Issue Error: Vanillamasker: There is no element to bind
I’m using the lib Vanillamasker for validation of a telephone field and date, only that these elements are within a modal bootstrap I tried to turn the function into a function like:…
-
5
votes2
answers12161
viewsA: Difference between RIGHT JOIN and LEFT JOIN
Own experience: Depending on how you diagram your bd, may have n tables, and depending on the need of your query, you may need to use a table as the main of your query, exemplifying with a…
-
0
votes1
answer36
viewsQ: Video with Reflection in firefox
I have the following structure that displays a video: div { height: 460px; width: 100% background: -moz-linear-gradient(top, black 0%, #020223 100%); /* FF3.6+ */ background:…
-
2
votes1
answer67
viewsA: Percentage of 0 to 5
Your problem is mainly in the calculation, if you are only working with integer values, I recommend using the function round along with the function intval. That’s because if you happen to work only…
-
2
votes2
answers106
viewsA: How to be less repetitive in my Javascript codes?
You can iterate everything within one for This way: function analysisShowPage1() { for (i = 1; i <= 5; i++) { $('#page' + i).removeClass('btn-warning').addClass('btn-success');…
-
4
votes2
answers534
viewsA: CSS tab system stops working when changing quantity
Each time you add more tabs, you will need to increase the number of * + in the CSS in part: #tabs-1 :checked + * + * + * + label { background-color: #FE7B43; color: #FFF; } #tabs-1 :checked + * + *…
-
1
votes1
answer294
viewsQ: Manipulate an image before adding it to a canvas element
I’m adding an image dynamically into a canvas, but I’m not getting it resized properly. var img = new Image(); img.src = "http://i.stack.imgur.com/lIaBN.jpg"; function inserir() { var canvas =…
-
5
votes1
answer45
viewsQ: Setting up an arena in canvas
I’m setting up an arena using HTML/JS with the canvas. I have the following code: function montarArena() { var canvas; var heightCanvas = 498; var widthCanvas = 598; var qtdLinhas =…
-
1
votes1
answer582
viewsA: Lightbox - Image Gallery
The example of this page that you mentioned has the dependency of 2 libraries that you should link/call on your page to work properly, jquery and magnific-popup, additional detail, should first call…
-
1
votes2
answers3520
viewsA: Applying JS to Validate Input with Onblur
Just call the function from the event onblur of input, as parameter you can pass the own elemento/input, with this to change the color becomes easier. As follows: function TestaCPF(elemento) { cpf =…
javascriptanswered MarceloBoni 6,385 -
1
votes2
answers2955
viewsA: Capture field value by its ID and turn into a variable
Change your line of code js to the following: var teste = $("#exemplo").html(); Would look like this: var teste = $("#exemplo").html(); alert(teste); <script…
-
1
votes1
answer303
viewsQ: Change maximum video size supported by server
I was testing a video on my page, only I came across a problem.... The line of my code is basically just that: <video id="video" src="arquivo.mp4" controls="true" /> The video resolution is…
-
0
votes3
answers804
viewsA: How to reload or refresh the CSS of the page with Javascript
You can change the css dynamically, there is something very conventional, but you can do something like: function alterar(valor){ switch(valor){ case "1": document.getElementById("main-css").href =…
-
4
votes1
answer219
viewsA: How to create a Christmas tree algorithm in PHP
You’re trying to concatenate strings, for this you use the . not the + in php. Just change the following line $linha += "*"; for $linha .= "*";: $linha = "*"; for($i = 0; $i < 6; $i++){…
-
1
votes2
answers204
viewsA: Move task - Angularjs
Taking advantage of your own delete code to implement something similar to what you want to do: angular.module('TarefApp', []); // Code goes here angular.module('TarefApp')…
-
2
votes1
answer144
viewsA: Cannot repeat when adding new item to a list
Just check inside the object $scope.tarefas if the new tarefa no longer exists, in function addTarefa add: for(var i=0; i < $scope.tarefas.length; i++){ if($scope.tarefas[i].nome ===…
-
1
votes1
answer111
viewsA: Logic of all possible mixtures of the values of a variable quantity array. PHP
If there is control over the amount of variables entering, you can create X structures for, where X is the number of variables in the array, doing something like: $arr = array("A","B","C"); for ($i…
-
3
votes1
answer195
viewsA: Initiation with Arduino
First point: You don’t need another Arduino to load another code on the board, simply plug it into the machine and into the software that can be downloaded for free on web, click on the button of…
arduinoanswered MarceloBoni 6,385 -
5
votes2
answers138
viewsQ: Make jQuery-Tools Handle accompany a team
I use the jQuery-Tools to create a custom effect scroll in a div as in the following example: "use strict"; var id_label_ms = document.getElementById("count_label_ms"); var range =…
-
7
votes1
answer228
viewsA: Python exercise
The indentation in Python must be respected so that the code is executed in perfect block. Just add a tab or 4 espaços[1] on lines running within conditional structures: def the_flying_circus(): if…
pythonanswered MarceloBoni 6,385 -
1
votes0
answers460
viewsQ: Catch errors generated in Avascript and display in a div
I have a div calling for log and would like to capture everything that is generated in the console, just below I Gero an index error to undefined a += 8;. The problem is that it only captures the…
javascriptasked MarceloBoni 6,385 -
4
votes2
answers493
viewsQ: Adding and removing elements in an array
I have the following structure: var elementos = ["teste1","teste2","teste3","teste4","teste5","teste6","teste7","teste8","teste9","teste10","teste11","teste12"]; var elementosPossui = []; function…
-
1
votes2
answers2151
viewsA: jquery percentage calculation
Well, follow my version of your code(I was just finishing up when @Toby posted the answer) I believe that the easiest thing would be to use the event onkeyup to receive the values of inputs, you can…
-
1
votes1
answer148
viewsA: Onselect / Javascript event
Good, me would not use the JQuery to make this check, to do what just use the event onchange and work as follows: function origem(valor){ if(valor == "Cliente"){…
-
5
votes6
answers47809
viewsA: How to search for a particular object within an array?
Another solution is to use the method .map (source:) https://stackoverflow.com/a/16008853/3956218) The method map() invokes the callback function passed by argument to each element of the Array and…
-
1
votes2
answers257
viewsA: Working with REDIPS drag-drop
Thanks to the help obtained by the friend @Maiconcarraro and the creator of the plugin Redips-DRAG @dbunic obtained here in SO I managed to solve the problem. follows below the complete code in case…
-
2
votes1
answer198
viewsQ: Creating application . exe type phonegap
I wonder if there is any application like the phonegap that translates packages a system html+js+css in a .exe If yes (I believe there is) What (is) tool(s) exists(m)? How to create?…
-
2
votes2
answers470
viewsA: Limiting the number of selected values
To check how many elements there are in an array just use array.length Within the else where you add the element in array, could do something like: if(listCheckedOptions.length >= 2){ alert("Máx…
-
4
votes2
answers1067
viewsA: Draw image using css
Using the pseudo-elements :after and :before: In their need it may be necessary to adapt the code by changing the values of top, left and rigth until you reach the effect you want div{ width: 0;…
-
2
votes4
answers3288
viewsA: Select with redirection
You can also simply put one onclick="location.href='seusite'" at the event onclick of the element option <select> <option value="Vilhena"…
-
1
votes1
answer1152
viewsA: Axes of a Cartesian plane changing according to the HTML5(canvas) + JAVASCRIPT zoom
Code adapted from: http://jsfiddle.net/ndYdk/7/ With the scale factor you apply only to the inside drawing(to the canvas inside points) without worrying about the canvas size. function…
-
1
votes3
answers5503
viewsA: Disable Function . click on DIV
You can use the event setAttribute thus: function desabilitarFunção(id){ document.getElementById(id).setAttribute('onclick', 'desabilitado()'); } function habilitarFunção(id){…
-
2
votes2
answers41
viewsA: How to stipulate details with a SELECT
Using the command if: <?php if ($conect['categoria'] == 1){ echo "Mundo"; }else if($conect['categoria'] == 2){ echo "Lua"; }else{ echo "Outros"; }; ?> Using the command case: <?php switch…
-
0
votes2
answers9548
viewsA: Curves / Waves in CSS
A question, you would like to work with the elements div, img with a ripple effect? Or just a line with ripple effect? You can make an effect like this with the element <hr> Selector :after,…
-
1
votes1
answer222
viewsA: Help with progress bar!
You can work with an event mix onScroll with the property scrollTop To figure out the maximum Scroll size, the best way I could find was: document.documentElement.scrollHeight -…
-
2
votes2
answers1617
viewsA: Remove Only One Item from a javascript list
You can use this function: var node = document.getElementById(id); if (node.parentNode) { node.parentNode.removeChild(node); } And then just put one id in div that has the content you’re adding…
javascriptanswered MarceloBoni 6,385 -
2
votes1
answer753
viewsA: How to appear what I typed in the input in an image
Following more or less my answer in your another question You can use the element canvas of HTML5 to create the image when typing. window.escreveNoCanvas = function(mensagem){ var canvas =…
-
2
votes2
answers1253
viewsA: Layout with diagonal div and responsive
You can work with the property css skew, would look something like this: transform:skewY(-10deg); .block{ width: 102%; } .formatado{ text-align: center; color:#FFF; font-size:100px; padding: 80px; }…
-
6
votes3
answers181
viewsA: Why in Javascript, 7 (a number) is not an instance of Number?
Strings and Numbers are primitive values, not objects, and therefore do not have a [[Prototype]], so it will only work if you instantiate them as objects. The same problem would occur in the case:…
javascriptanswered MarceloBoni 6,385 -
1
votes1
answer168
viewsA: How to not let an image load in javascript
You can leave the image with style="display: none" and change to style="display: block" when its function is executed. function funcaoExibir(){ img.style.display='block'; } function funcaoOcultar(){…
javascriptanswered MarceloBoni 6,385 -
1
votes3
answers446
viewsA: How to write and appear somewhere what I wrote
Another way to get the desired result: window.mostrarTexto= function(valor){ var campo = document.getElementById("campo").value; div.innerHTML = campo; } <input id="campo" type="text"…
-
3
votes3
answers1332
viewsA: Run functions without the Jquery click event
I find it kind of unnecessary to use Jquery in that case, you could get the desired result using only JavaScript pure.... Good, anyway an alternative solution using only JavaScript, without Jquery…
-
1
votes3
answers104
viewsA: How to place an image on the website via link
I’m not sure the box you set up had that goal But there are some errors in the code HTML that you went through comment, unopened tags and the source image in div(?) The right would be something…
-
1
votes4
answers8659
viewsA: Receive real-time input value
Basing myself in that reply from @Bacco, you can use the attribute onchange field to make this check. function funcao(data){ var dtInicio = document.getElementById('data1'); var dtFim =…
-
3
votes2
answers257
viewsQ: Working with REDIPS drag-drop
I’m working with a library called REDIPS that makes it possible to create a customizable and simple drag-drop effect.... I am trying to create a function that causes the element being moved to be…
-
0
votes3
answers3573
viewsA: How to display only half of the div background-color
You can use this online tool, more useful to emulate your div: http://makewebsimple.net/cssdivbuilder To generate the gradient I use this other online tool:…
-
0
votes4
answers2045
viewsA: How to limit PHP words
You can use the function substr() and do something like that: <?php $variavel = substr($row['title'], 0, -5)) ?> <spam title="<= $row['title']; ?>"><= $variavel…
-
4
votes1
answer105
viewsQ: Is there any way for a div to assume the role of the scroll?
I have the following code: $("#scroll").draggable({ axis: "x", scroll: true, containment: "#area" }); .area{ position: absolute; width: 1010px; height: 100px; margin-top:10px; margin-left:10px;…