Posts by Diego Henrique • 2,916 points
172 posts
-
1
votes1
answer138
viewsQ: How to reverse mouse click events?
Hit me a recent doubt, where the click of left button mouse could in a specific case become the right, and vice versa. Code var menulist = document.oncontextmenu; var menu = function(ev) { if…
-
1
votes1
answer604
viewsQ: What alternative mode could be used to block the click effect on an HTML element?
Based on an example by Sergio - How to prevent a click on a link/anchor or tied event element Example of my own making var ancora = document.getElementsByClassName('baixar'); for (var i in ancora) {…
-
1
votes1
answer26
viewsQ: How can I remove every link that points to a video after the video ends?
I have this div below, namely with id and having within it the elements p followed a(anchor): var vid = document.getElementById('player'); var link =…
-
2
votes1
answer34
viewsQ: How to create a copy of an element, through its property
I want clone only images whose the attribute alt be "photo". Code var str = document.getElementById('A'); var clone = str.cloneNode(true); document.getElementById('B').appendChild(clone); <span…
-
2
votes1
answer932
viewsQ: How to set variable within match method (String)
What I want is to include the variable within the (/.../) and not its value. Code: var str = 'Seu texto aqui!'; if (str.match(/texto/)) { alert('Palavra encontrada.'); } Instead of setting manually,…
-
1
votes1
answer148
viewsQ: How to duplicate visualization of HTML elements
I have 5 images, and 3 of them have the same class being exhibited on div To. <div id='A'> <img src="https://sites.google.com/site/mplayerplugin/thumbnails/09.jpg" class="figura" />…
-
0
votes3
answers101
viewsQ: What condition can I develop to avoid duplicating values?
How to avoid duplicate numbers in this random generator? var soma = 0 while (soma < 1000) { soma += parseInt(Math.random() * 100) document.write(soma + "<br>") } As it goes running, it…
-
2
votes1
answer614
viewsQ: How do I return the total sum of the repeated words within all div?
To illustrate the degree of difficulty, I place 3 div and within them identical words, purposeful to add their duplication. <div> <div> <div> Diego Ademir Diego Maicon Diego Maicon…
-
0
votes1
answer212
viewsQ: How to invoke countdown every click on the button?
I want to develop something simple, but it’s making me frustrated. I will try to express myself in the best possible way. To simplify things around here, I’m only bringing as an example a randomized…
-
0
votes1
answer164
viewsQ: How to clone array
I’m wandering about on a way to make sure that as all elements of the array in question, go all over again. See this my source code below: Code <html> <body> <button…
-
0
votes1
answer40
viewsQ: I always want to delete the first index every time I click a button. How do I do it?
Seen what I tried: <html> <body> <script> var nome = ['1', '2', '3', '4', '5', '6', '7', '8', '9']; var remover = nome.slice(0); function shuffle(array) { return…
-
5
votes1
answer3305
viewsQ: How do I uncheck the previous radio button after selecting another one?
I have five radio button, of these five one is "marked", as I do to unmark the radio button that I clicked after clicking on another? Example: <fieldset>…
-
1
votes2
answers373
viewsQ: How do I search by date?
I intend to create a "date" search system. It may not be the best question in the world. But I find valid and interesting, with the potential to generate good content for the site. Example var…
-
2
votes1
answer421
viewsQ: How to overlay floating div on other elements of the web page?
I am creating a new plugin bookmarklet which will apply on any video page of Youtube, where I have to add a div floating in the body, thus doing the appendChild in the GIFT. However a fault is…
-
2
votes1
answer116
viewsQ: Why does "Undefined" occur even defining the exact element to be hit?
I’m applying a injection in the web browser address bar, on the page of a video on youtube, in which I want to extract the date of the post of the same. If we open this link we see a div similar to…
-
0
votes1
answer1787
viewsQ: View and hide images with Javascript
I need help with the source code below: CSS: img { display: block; } Javascript: var total = 5; var numero = 1; function mostrar() { if (numero <= total) { var inicio = (numero - 1) * 1 + 1; for…
-
2
votes2
answers908
viewsQ: How to perform an internal search for the id?
How can I know if a certain element exists, via field input? Example <html> <body> <input type="text" id="txt"><input type="button" value="mais" onclick="busca()">…
javascriptasked Diego Henrique 2,916 -
0
votes1
answer156
viewsQ: How to show 5 in 5 hidden elements?
I was struck by a doubt recently, by which I must manipulate a certain number of elements hidden through the display:none; that it is defined on the span that involves all of them. Example…
-
2
votes3
answers1037
viewsA: How to dynamize a numerical sequence of 3 in 3 numbers following the order?
Follows other alternatives: We have to define three variables in the global scope that will function as initialization, another as condition, and a click counter. Example 1 var n = 0; var i = 0; var…
javascriptanswered Diego Henrique 2,916 -
7
votes3
answers1037
viewsQ: How to dynamize a numerical sequence of 3 in 3 numbers following the order?
Type: 1 2 3 ... 4 5 6 ... 7 8 9 And so on and so forth. Example var clic = 0; function mais() { if (clic == 1) { document.getElementById('txt').textContent += "1 2 3 " } else if (clic == 2) {…
javascriptasked Diego Henrique 2,916 -
1
votes3
answers1185
viewsA: How to insert a new value into an array without duplicating through the switch case?
After a few responses given both by Victor Stafusa, followed by the colleague handoncloud, I have come to the final conclusion. Let’s see how to check if the value exists in the collection of array…
-
0
votes3
answers1185
viewsQ: How to insert a new value into an array without duplicating through the switch case?
One of my attempts so far has been: array = [1, 2, 4, 5]; definir = function() { switch (array) { case (array > 1): array.push(1); break; case (array > 2): array.push(2); break; case (array…
-
-2
votes4
answers763
viewsA: What would be a good way to apply events: onMouseOver and onMouseOut, for all img tags?
An alternative to reach all tags img similar to the modern API adventListener, would use the event captureEvents. Behold: var figura = document.getElementsByTagName("img"); for (var i in figura) {…
-
8
votes4
answers763
viewsQ: What would be a good way to apply events: onMouseOver and onMouseOut, for all img tags?
I need this function to be automated so that it applies to all images built on the HTML document without any exception Code function aumenta(obj) { obj.height = obj.height * 2; obj.width = obj.width…
-
0
votes1
answer114
viewsA: How to include selector next and Prev on XML elements
Follows the answer: function mostrar() { var txt, parser, xmlDoc; txt = "<carta>" + "<item>" + "<para>Marcos</para>" + "<de>Luciana</de>" +…
-
0
votes1
answer114
viewsQ: How to include selector next and Prev on XML elements
I’m having trouble eliciting XML elements on flow control Prev/next, what I have is: Code function mostrar(i) { var txt, parser, xmlDoc; txt = "<carta>" + "<para>Marcos</para>" +…
-
3
votes1
answer2272
viewsQ: How to search for an element in XML using Javascript
I want to search for a certain element (in case name) in a document XML, using only one input text-type. Code of what I’ve already got TagXML = function() { dados = "<doc>" dados = dados +…
-
0
votes1
answer141
viewsA: How to Develop Related Videos
Follows my model: body { background-color: whitesmoke; } .player a span { display: none; } .player a:hover span { background: transparent; display: block; position: absolute; z-index: 100; } .player…
-
1
votes1
answer141
viewsQ: How to Develop Related Videos
I want to create a script that works like on websites of the genre: Dailymotion, Metacafe and so many other video repositories that do this. When the user opens a video he puts the video to run…
-
1
votes2
answers173
viewsA: How to make multiple values into a single option and retrieve them
Below is the code to capture the multiple values in a single option that will be used in our "test" is well commented, dispensing more details. extrair = function() { var texto =…
-
-1
votes2
answers173
viewsQ: How to make multiple values into a single option and retrieve them
I want to know how to make a list with a specific tab "|" and define more than one value in select-option and recover in Javascript with a split("|") for a variable, something like: <select…
-
0
votes2
answers319
viewsA: Create playlist with select-option and video elements, Object and embed
This routine just checks if the browser supports tag video, and directs an alternative. <script> // criar o elemento <video> var video = document.createElement("video"); // acrescentar…
-
0
votes2
answers319
viewsQ: Create playlist with select-option and video elements, Object and embed
To play Youtube videos on a playlist web page select-option, I bring a simple example: Code troca = function (link) { document.getElementById('video').innerHTML = '<iframe src="'+link+'"…
-
0
votes3
answers452
viewsA: There is a useful way to highlight an HTML element/tag(a) in a certain color
Follow another alternative. body { background-color: lightblue; font-size: 10pt; } #code { background-color: whitesmoke; } samp { color: tomato; } <strong>Exemplo: o Meu Primeiro código de…
-
3
votes1
answer169
viewsQ: I want to count and quantify the Array index on onclick control
I want to create a simple element-based pagination within an array. When arriving at the first and/or last element of the array, I would like to disable the respective navigation button (e.g., by…
-
2
votes3
answers452
viewsQ: There is a useful way to highlight an HTML element/tag(a) in a certain color
Well, I want to define a color tag style. The following example changes the style of an element <p id="tag"> parágrafo </p> To change the style of an HTML element, this syntax is used:…
-
0
votes2
answers1666
viewsA: Manipulate all images from a directory without having to access
Moshmage said - "There is a way to do this client-side. What you have to do is create a "self-recurring-Function" that calls itself" In a free translation self-recurring-Function, that is to say -…
-
2
votes1
answer913
viewsQ: Infinite counting of ordinal numbers and exposing in HTML document
What I want to know is how I can make a rising counter in pure Javascript 0 , 1 , 2 , ... I want something automatic, infinite without needing an arrow an integer or negative number Counting can…
-
1
votes2
answers1666
viewsQ: Manipulate all images from a directory without having to access
The Script below, is in charge of showing a sequence of images at a certain amount rate (one), so it is necessary to define a number of images. Check out: Code <html> <body>…
-
4
votes1
answer428
viewsA: Is it possible to hide the redirect, but keep the link for the download?
I elaborated using reverse engineering, that is, observing and imagining how such behavior would be. Check out below how it was: <a href="javascript:(function(){var popup = window.open(); URL =…
-
4
votes1
answer428
viewsQ: Is it possible to hide the redirect, but keep the link for the download?
I made a simple favlet, to facilitate the task of converting videos from Youtube audio: <a…
-
1
votes1
answer118
viewsQ: How can you find a word in the text of a table?
I’ve made several attempts with this logic: <html> <head> <script> window.onload = function(){ var filtro = document.getElementById('nome').value; var tabela =…
-
2
votes1
answer158
viewsQ: How could you hide too many pagination numbers
I have the source code already written. Check out below: var str = "ABCDEFGHIJKLMNOPQRSTUVXWYZ" var link = []; for(var i = 0; i < str.length; i++) { var letra = str.charCodeAt(i) - 64; link[i] =…
javascriptasked Diego Henrique 2,916 -
3
votes2
answers114
viewsQ: How to mark/deselect a link on a page by clicking on next/back?
Would like to mark and cancel one "link" on a page ... Example var contar = 0; link = document.getElementsByTagName('a') // Rotina Do Botão Próximo document.getElementById('frente').onclick =…
javascriptasked Diego Henrique 2,916 -
3
votes1
answer261
viewsQ: Count vector elements and place links on the page
I want to make a script which counts how many vector tiles I have inside new Array. Example var array = new Array('001.html', '002.html', '003.html', '004.html', '005.html') .. and add them in the…
-
1
votes2
answers92
viewsQ: Create control flow in playlist for web player
To illustrate what I’m looking for, note the figure: Screen Shot For this I put the source code for example: Code <html> <head> <style type="text/css"> #slide #screenshot { width:…
-
7
votes2
answers38101
viewsQ: Checking if value exists in an array via search field
In pure javascript I can use indexOf(), something like that: var chaves = ['wmv','3gp','mp4','mp3','avi']; if(chaves.indexOf("avi") != -1) { alert("Ok!"); } But in the case of a search ground I’m…
-
2
votes1
answer881
viewsA: Creating new users through Shell Script
Anyone running a GNU/Linux distro can already try it, or for those who don’t have it, use some Livecd or USB linux platform system. Code #!/bin/sh # # Por - Diego Henrique…
-
0
votes1
answer881
viewsQ: Creating new users through Shell Script
I’m trying to create a shell script to add new users to the GNU/Linux system But without entering native commands like adduser or useradd in the script, it would be something in the nail. I have…
-
0
votes2
answers241
viewsA: How to switch the #(fence) symbol by the $(dollar sign) in the terminal after switching user
[...] how does it work [...] how this should be done [...] I solved it this way: I downloaded the package passwd.tgz of Slackware-0.4 This contains the "Getty" which is the second of the three…