Search:
Type: Posts; User: mrhoo
Search :
Search took 0.08 seconds.
Where does str come from in your code, and why are you splitting it on a space instead of 'x' or ' x '?
You are finding 4 digits, as requested by your pattern.
If you want to restrict the match to strings that only contain 2-4 digits and nothing else, flag the beginning and end of the string-
...
// I prefer to let the machine do the work-
function dowFromDmy(input){
var M= input.value.match(/(\d+)/g);
if(M){
return 'Sun,Mon,Tues,Wednes,Thurs,Fri,Sat'.split(',')[
...
You have around 30000 characters, if you type an average 40wpm you could do it in about 3 hours.
Knowing what to type, and possibly testing it as you write, takes longer.
You'd be better off comparing top.location.href and location.href, since some browsers have a separate location object for top and child location objects, even it they have the same href. Two objects...
excuse it- I neglected to see your assigning via innerHTML, which doesn't work for table cells in older IE's.
Use strings instead of numbers- you can alert(number.toString(8))
to return 106341417 in most browsers, but it is an error in strict code,
and no number except 0 in any base begins with a zero-...
Forget the local offset, it has no relevance to other timezones.
Use UTC time methods- for each timezone, add the offset (positive or negative) to the UTC time, then read the UTC properties, and...
You can replace the operators with themselves followed by a newline.
function calc(strIn){
strIn= strIn.replace(/[^\.\d*\/+-]+/g, '');
var tarrN= strIn.replace(/([\D\.]+)/g, '$1\n')+...
Most browsers implement the Array method .indexOf(what, i),
which returns the first index at which its value is found(starting at i, or 0 if not specified).
If the value is not found in the array,...
I meant to edit the previous post but waited too long- this is a simpler version of the same script-
<!doctype html>
<html lang="en">
<head>
<meta charset= "utf-8">
<title>nth days</title>
...
<!doctype html>
<html lang="en">
<head>
<meta charset= "utf-8">
<title>nth days</title>
</head>
<body>
<ul>
<script>
var s='abcd2DPM_0361.DSS|1588224: abcdinterv120808wc.doc|28672: abcdDPM_0360.DSS|563712: abcd3_0365.DSS|1565184: Abcd_Last-GK.DSS|771072:';
s.replace(/\|[^:]*\:/g,' '); //replace pipe followed by...
google combinations and permutations.
// Pass the empty string
function highlightControl(ctl, mode){
document.getElementById(ctl).style.borderColor= mode== 'on'? 'red':'';
}
I find that burying it in the garden works well.
When you use number.toFixed() with no argument you convert number to an integer with no decimal.
number.toFixed(10) may be what you need.
If you want to include trailing zeroes for numbers with...
You are subtracting item.x while you are defining it- nothing to do with regular expressions.
var itm={canvas:{width:100},sprite_width:50};
itm.x = itm.canvas.width / 2 - itm.sprite_width / 2...
This is another approach.
<!doctype html>
<html lang="en">
<head>
<meta charset= "utf-8">
<title>Military Jargon</title>
<style>
body{font-size:125%;margin:1em;}
slice will return a (shallow) copy of the indexed array items, not any custom properties you have added.
https://developer.mozilla.org/en/DOM/element.onresize
According to MDN, only the window has a resize event.
That's called a shallow clone, and makes copies of arrays of primitives- (strings, numbers, booleans, undefined).
If you are cloning an object with properties that are objects, (including arrays)...
You have an array with two indexed elements and four named properties.
It is as much code to clone it as to write a new one.
var NAMEDONS= ["George", "Elisabeth"];
NAMEDONS["George "]=...
It is easy with 2 expressions-
var equalAandB=(str.match(/a/g) || []).length === (str.match(/b/g) || []).length;
open a new window, document.write the innerHTML string, call print from the new window.