Skip to content
Advertisement

Tag: javascript

Create a pause inside a while loop in Javascript

I would like to create a pause inside a while loop so that I can create n animations that each appear 3 seconds after the other. I’ve tried the following, but it doesn’t work. Would love to have someone show me what I’m doing wrong. Answer setTimeout does not pause; it asks Javascript to run some other code later. Googling

How to get character array from a string?

How do you convert a string to a character array in JavaScript? I’m thinking getting a string like “Hello world!” to the array [‘H’,’e’,’l’,’l’,’o’,’ ‘,’w’,’o’,’r’,’l’,’d’,’!’] Answer Note: This is not unicode compliant. “Iđź’–U”.split(”) results in the 4 character array [“I”, “ďż˝”, “ďż˝”, “u”] which can lead to dangerous bugs. See answers below for safe alternatives. Just split it by an

Download a file by jQuery.Ajax

I have a Struts2 action in the server side for file downloading. However when I call the action using the jQuery: in Firebug I see the data is retrieved with the Binary stream. I wonder how to open the file downloading window with which the user can save the file locally? Answer 2019 modern browsers update This is the approach

Close all infowindows in Google Maps API v3 [duplicate]

This question already has answers here: Google Maps close previous Infowindow when another marker is clicked (1 answer) Google map API v3 – Add multiple infowindows (2 answers) Google Maps JS API v3 – Simple Multiple Marker Example (15 answers) Closed last month. I am busy with a script that will make a google maps canvas on my website, with

What is console.log?

What is the use of console.log? Please explain how to use it in JavaScript, with a code example. Answer It’s not a jQuery feature but a feature for debugging purposes. You can for instance log something to the console when something happens. For instance: You’d then see #someButton was clicked in Firebug’s “Console” tab (or another tool’s console — e.g.

Javascript Equivalent to PHP Explode()

I have this string: 0000000020C90037:TEMP:data I need this string: TEMP:data. With PHP I would do this: How do I effectively explode a string in JavaScript the way it works in PHP? Answer This is a direct conversion from your PHP code:

Search a table looking for labels

I am trying to search a table looking for all the labels in that table. When the JavaScript function finds a label I want to set it’s visibility to false. My html code looks like this: My function is called on a drop down lists onchange event which then passes the table that holds all the labels I want to

javascript regular expression to check for IP addresses

I have several ip addresses like: 115.42.150.37 115.42.150.38 115.42.150.50 What type of regular expression should I write if I want to search for the all the 3 ip addresses? Eg, if I do 115.42.150.* (I will be able to search for all 3 ip addresses) What I can do now is something like: /[0-9]{1-3}.[0-9]{1-3}.[0-9]{1-3}.[0-9]{1-3}/ but it can’t seems to work

Advertisement