|
Featured Sponsor Of The Month
|
|
I just finished a rather tough piece of JavaScript for a new customer. Let me explain what they wanted... they had a map made from the Google API. I didn't know it, but these maps are generated basically by a giant <script> dynamically. On this map, there were a number of companies that my customer does business with. Well, inevitably, one of the companies went out of business, so they wanted to have the company removed from the Google Map. Originally, the code looked like this:
Geez, that's ugly! Well, after going through it a bit, I saw the line markers[i].getAttribute("title") and thought, "hmmm... I wonder if I can capture the name of the company and shortcut it before the marker is set?" With that, I got working on this JavaScript. I was tearing it apart and alerting everything I could. I finally wrapped it in with a quick conditional, and what do you know - it worked first time. Gotta love it when a plan comes together! Here's how I did it... I changed the section so that it would look like All it took was that one conditional statement. I'm still excited about this! With this, you can now programmatically add or remove points on a Google Map simply by searching for the markers[i].getAttribute("title") attribute and acting accordingly.
|
||||||||||||||||||||||||||||||||||||||||||||||||||||
People Online: 67
BrainStorm MultiMedia is an internet-based company run by Bradley Beard that provides free tutorials on PHP, MySQL, JavaScript, Dreamweaver MX, Flash MX, ActionScript, Fireworks MX, ColdFusion MX, cPanel X, Photoshop 7, CuteFTP, SQL Server 2000, how to start ranking high in Google, web site promotion and enhancement, and search engine optimization. Along with these tutorials, I also do freelance web design using PHP/MySQL or ColdFusion.
|