Re: Javascript replace()

Saturday, May 31, 2014

0 comments
The replace function doesn't change the string, it returns the modified version of the string. You want...
ans = ans.replace(...);


On Sat, May 31, 2014 at 1:37 PM, <spjurewicz@gmail.com> wrote:
 
This replace isn't working:
 
var ans = "<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mrow><mtext id='carat'>|</mtext></mrow></math>";
ans.replace("<mtext id='carat'>|</mtext>", "<mfrac><mrow><mtext id='carat'>|</mtext></mrow><mrow><mn>3</mn></mrow></mfrac>");
 
Any ideas?
 
Thanks!

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Javascript replace()

0 comments
 
This replace isn't working:
 
var ans = "<math xmlns='http://www.w3.org/1998/Math/MathML' display='block'><mrow><mtext id='carat'>|</mtext></mrow></math>";
ans.replace("<mtext id='carat'>|</mtext>", "<mfrac><mrow><mtext id='carat'>|</mtext></mrow><mrow><mn>3</mn></mrow></mfrac>");
 
Any ideas?
 
Thanks!

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

BEVERLY HILLS MASTER PSYCHIC~ ACCURATE & AMUSING

Tuesday, May 27, 2014

0 comments
Your first 3 minutes are FREE talking live with me.

Please visit my website at: http://www.keen.com/Ask+Fran

Or, call me right now at: 1-800-275-5336 x0160

--
You received this message because you are subscribed to the Google Groups "Website Design Nz" group.
To unsubscribe from this group and stop receiving emails from it, send an email to website-design-nz+unsubscribe@googlegroups.com.
To post to this group, send email to website-design-nz@googlegroups.com.
Visit this group at http://groups.google.com/group/website-design-nz.
For more options, visit https://groups.google.com/d/optout.

Never Trade Forex if You Cannot Spend Time To Read This!

Monday, May 26, 2014

0 comments
Hello,

Please go to: http://www.forexfactory.com/showthread.php?p=7491606#post7491606

Thanks.

--
You received this message because you are subscribed to the Google Groups "Website Design Nz" group.
To unsubscribe from this group and stop receiving emails from it, send an email to website-design-nz+unsubscribe@googlegroups.com.
To post to this group, send email to website-design-nz@googlegroups.com.
Visit this group at http://groups.google.com/group/website-design-nz.
For more options, visit https://groups.google.com/d/optout.

Re: Arrays

Friday, May 23, 2014

0 comments
You can use a function similar to the following:

function subtractArrayValues(arr1, arr2) {
    var i,
        arr3 = [];
    
    for(i=0;i<arr1.length;i++) {
        arr3.push(arr1[i] - arr2[i])
    }
    
    return arr3;
}

Array3 = subtractArrayValues(Array1, Array2);

On Friday, May 23, 2014 1:32:20 PM UTC-4, I.O.S wrote:
Hi All,

I have 2 arrays and I would like to subtract the contents of one from the other and store in another array.

Ex:
Array1 = [10, 15, 25]
Array2 = [5, 12, 9]

Results should be
Array3 = [5, 3, 16]

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Arrays

0 comments
Hi All,

I have 2 arrays and I would like to subtract the contents of one from the other and store in another array.

Ex:
Array1 = [10, 15, 25]
Array2 = [5, 12, 9]

Results should be
Array3 = [5, 3, 16]

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Website Design Services in UK | USA | Hongkong | Malaysia | India | CANADA | JAPAN | SINGAPORE | EUROPE | GREENLAND

Wednesday, May 21, 2014

0 comments
Ave Infosys is a leading professional in Web Designing Company in Hyderabad India for the

E-Business Industry.Ave Infosys are providing Best Website Development and Design Services

in Hyderabad.Our company offers the Best Web Design & Development services, Web Hosting

Services,Responsive and Mobile Designing services,Ecommerce websites services,Digital

Marketing Services,Website Design Services. We have intensive web design and web skills

merging with the quality essence of expertise should have component to help you to ascertain

your internet presence or take it to the next level.we are the Best Web Design Company in

Hyderabad.

For More Details :

Please contact: (+91) 40 40275321

Email : info@aveinfosys.com

Web : http://aveinfosys.com/website-design

--
You received this message because you are subscribed to the Google Groups "Web Design & Programming | Tutorials - Tips - Tricks" group.
To unsubscribe from this group and stop receiving emails from it, send an email to web-des-prog+unsubscribe@googlegroups.com.
To post to this group, send email to web-des-prog@googlegroups.com.
Visit this group at http://groups.google.com/group/web-des-prog.
For more options, visit https://groups.google.com/d/optout.

Re: Evaluating variable in loop at time of creation

Thursday, May 15, 2014

0 comments
Thanks very much Binary Tutor - I had found some links to this online but hadn't managed to get it to work. Now it works perfectly. Thank you.

On Thursday, May 8, 2014 10:27:45 PM UTC-7, Binary Tutor wrote:
What you need to do is create a closure.

for(i=0;i<locations.length;i++) {
    //var thisLocation;
    //thisLocation = eval('location' + (i+1));
    coords = locations[i];
    mapLocations[i] = L.mapbox.featureLayer({
        type: 'Feature',
        geometry: {
            type: 'Point',
            coordinates: coords
        },
        properties: {
            'marker-size': 'large',
            'marker-color': '#ec0112'
        }
    }).addTo(map);
    mapLocations[i].on('click', function(i) {
         // This is a closure. i becomes a local variable
         // to the function below.
         return function () {
            $('.rental-location').css('display', 'none');
            $('.rental-location-' + (i+1)).css('display', 'block');
         };
    }(i);
}

On Wednesday, May 7, 2014 9:05:16 PM UTC-4, Anthony Glazebrook wrote:
I am creating markers on a Mapbox page and when the marker is clicked, it needs to open a different layer on the calling page.

I tried creating a loop where the marker click event was assigned automatically based on the index of the loop, but this evaluated the index value at the time of running, rather than the time of creation.

How can I extract this index value and have it called at the time of running?

Here is the code:

// Create a map in the div #map
var map = L.mapbox.map('map', 'marashi760.heap66lg')
    .setView([lat, lng], zoom);
var locations = [
    [-122.386839, 37.650615],
    [-118.398227, 33.94466],
    [-117.191262, 32.744102],
    [-117.860223, 33.680488],
    [-118.144392, 33.818421],
    [-122.219743, 37.712569],
    [-121.925906, 37.366695],
    [-121.590065, 38.695085],
    [-117.346057, 33.163207]
];
var mapLocations = new Array();
for(i=0;i<locations.length;i++) {
    //var thisLocation;
    //thisLocation = eval('location' + (i+1));
    coords = locations[i];
    mapLocations[i] = L.mapbox.featureLayer({
        type: 'Feature',
        geometry: {
            type: 'Point',
            coordinates: coords
        },
        properties: {
            'marker-size': 'large',
            'marker-color': '#ec0112'
        }
    }).addTo(map);
}
mapLocations[0].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-1').css('display', 'block');
});
mapLocations[1].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-2').css('display', 'block');
});
mapLocations[2].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-3').css('display', 'block');
});
// etc for all markers

I tried adding this into the loop:
    mapLocations[i].on('click', function() {
        $('.rental-location').css('display', 'none');
        $('.rental-location-' + (i+1)).css('display', 'block');
    }

but it the penultimate line always evaluates (i+1) to the value of i at the time of running, rather than creation. It seems silly that I have to manually assign the click functionality rather than iterate through the markers.

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

MASTER PSYCHIC READER~ ACCURATE & AMUSING

Sunday, May 11, 2014

0 comments
Your first 3 minutes are FREE talking live with me.

Please visit my website at: http://www.keen.com/Ask+Fran

Or, call me right now at: 1-800-275-5336 x0160  

--
You received this message because you are subscribed to the Google Groups "Website Design Nz" group.
To unsubscribe from this group and stop receiving emails from it, send an email to website-design-nz+unsubscribe@googlegroups.com.
To post to this group, send email to website-design-nz@googlegroups.com.
Visit this group at http://groups.google.com/group/website-design-nz.
For more options, visit https://groups.google.com/d/optout.

Re: Evaluating variable in loop at time of creation

Thursday, May 8, 2014

0 comments
What you need to do is create a closure.

for(i=0;i<locations.length;i++) {
    //var thisLocation;
    //thisLocation = eval('location' + (i+1));
    coords = locations[i];
    mapLocations[i] = L.mapbox.featureLayer({
        type: 'Feature',
        geometry: {
            type: 'Point',
            coordinates: coords
        },
        properties: {
            'marker-size': 'large',
            'marker-color': '#ec0112'
        }
    }).addTo(map);
    mapLocations[i].on('click', function(i) {
         // This is a closure. i becomes a local variable
         // to the function below.
         return function () {
            $('.rental-location').css('display', 'none');
            $('.rental-location-' + (i+1)).css('display', 'block');
         };
    }(i);
}

On Wednesday, May 7, 2014 9:05:16 PM UTC-4, Anthony Glazebrook wrote:
I am creating markers on a Mapbox page and when the marker is clicked, it needs to open a different layer on the calling page.

I tried creating a loop where the marker click event was assigned automatically based on the index of the loop, but this evaluated the index value at the time of running, rather than the time of creation.

How can I extract this index value and have it called at the time of running?

Here is the code:

// Create a map in the div #map
var map = L.mapbox.map('map', 'marashi760.heap66lg')
    .setView([lat, lng], zoom);
var locations = [
    [-122.386839, 37.650615],
    [-118.398227, 33.94466],
    [-117.191262, 32.744102],
    [-117.860223, 33.680488],
    [-118.144392, 33.818421],
    [-122.219743, 37.712569],
    [-121.925906, 37.366695],
    [-121.590065, 38.695085],
    [-117.346057, 33.163207]
];
var mapLocations = new Array();
for(i=0;i<locations.length;i++) {
    //var thisLocation;
    //thisLocation = eval('location' + (i+1));
    coords = locations[i];
    mapLocations[i] = L.mapbox.featureLayer({
        type: 'Feature',
        geometry: {
            type: 'Point',
            coordinates: coords
        },
        properties: {
            'marker-size': 'large',
            'marker-color': '#ec0112'
        }
    }).addTo(map);
}
mapLocations[0].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-1').css('display', 'block');
});
mapLocations[1].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-2').css('display', 'block');
});
mapLocations[2].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-3').css('display', 'block');
});
// etc for all markers

I tried adding this into the loop:
    mapLocations[i].on('click', function() {
        $('.rental-location').css('display', 'none');
        $('.rental-location-' + (i+1)).css('display', 'block');
    }

but it the penultimate line always evaluates (i+1) to the value of i at the time of running, rather than creation. It seems silly that I have to manually assign the click functionality rather than iterate through the markers.

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Evaluating variable in loop at time of creation

Wednesday, May 7, 2014

0 comments
I am creating markers on a Mapbox page and when the marker is clicked, it needs to open a different layer on the calling page.

I tried creating a loop where the marker click event was assigned automatically based on the index of the loop, but this evaluated the index value at the time of running, rather than the time of creation.

How can I extract this index value and have it called at the time of running?

Here is the code:

// Create a map in the div #map
var map = L.mapbox.map('map', 'marashi760.heap66lg')
    .setView([lat, lng], zoom);
var locations = [
    [-122.386839, 37.650615],
    [-118.398227, 33.94466],
    [-117.191262, 32.744102],
    [-117.860223, 33.680488],
    [-118.144392, 33.818421],
    [-122.219743, 37.712569],
    [-121.925906, 37.366695],
    [-121.590065, 38.695085],
    [-117.346057, 33.163207]
];
var mapLocations = new Array();
for(i=0;i<locations.length;i++) {
    //var thisLocation;
    //thisLocation = eval('location' + (i+1));
    coords = locations[i];
    mapLocations[i] = L.mapbox.featureLayer({
        type: 'Feature',
        geometry: {
            type: 'Point',
            coordinates: coords
        },
        properties: {
            'marker-size': 'large',
            'marker-color': '#ec0112'
        }
    }).addTo(map);
}
mapLocations[0].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-1').css('display', 'block');
});
mapLocations[1].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-2').css('display', 'block');
});
mapLocations[2].on('click', function() {
    $('.rental-location').css('display', 'none');
    $('.rental-location-3').css('display', 'block');
});
// etc for all markers

I tried adding this into the loop:
    mapLocations[i].on('click', function() {
        $('.rental-location').css('display', 'none');
        $('.rental-location-' + (i+1)).css('display', 'block');
    }

but it the penultimate line always evaluates (i+1) to the value of i at the time of running, rather than creation. It seems silly that I have to manually assign the click functionality rather than iterate through the markers.

--
You received this message because you are subscribed to the Google Groups "JavaScript Forum" group.
To unsubscribe from this group and stop receiving emails from it, send an email to javascript-information+unsubscribe@googlegroups.com.
For more options, visit https://groups.google.com/d/optout.

Copyright © 2010 Web Design | Free Blogger Templates by Splashy Templates | Layout by Atomic Website Templates

Vida de bombeiro Recipes Informatica Humor Jokes Mensagens Curiosity Saude Video Games Animals Diario das Mensagens Eletronica Rei Jesus News Noticias da TV Artesanato Esportes Noticias Atuais Games Pets Career Religion Recreation Business Education Autos Academics Style Television Programming Motosport Humor News The Games Home Downs World News Internet Design Entertaimment Celebrities 1001 Games Doctor Pets Net Downs World Enter Jesus Mensagensr Android Rub Letras Dialogue cosmetics Genexus lasofia thebushrajr wingshock tripedes gorduravegetal dainfamia dejavu-transpersonal jsbenfica republicadasbadanas ruiherbon iranianforaryans eaystcheyl fotosdanadir Só Humor Curiosity Gifs Medical Female American Health Madeira Designer PPS Divertidas Estate Travel Estate Writing Computer Matilde Ocultos Matilde futebolcomnoticias girassol lettheworldturn topdigitalnet Bem amado enjohnny produceideas foodasticos cronicasdoimaginario downloadsdegraca compactandoletras newcuriosidades blogdoarmario arrozinhoii