Skip to main content

Posts

Replacing special characters like dots in javascript

I have a search query from the user and I want to process it before applying to browser. since I'm using SEO with htaccess and the search url looks like this : /search/[user query] I should do something to prevent user from doing naughty things.. :) Like searching ../include/conf.php which will result in giving away my configuration file. I want to process the query like removing spaces, removing dots(which will cause problems), commas,etc. var q = document.getElementById('q').value; var q = q.replace(/ /gi,"+"); var q = q.replace(/../gi,""); document.location='search/'+q; the first replace works just fine but the second one messes with my query.. any solution to replacing this risky characters safely?

Animated sliding divs on click button jQuery

Im trying to write a simple script that slides the next 'slide' div in on a button click, I have 3 divs all inline, left alligned. theyre all set to a width, on 'next' button click id like the next slide to slide in, ive made the following fiddle only I cant seem to get it working... Can anybody see where im going wrong? http://jsfiddle.net/x2qk7/ Thanks

Need to add 45+ points to a google map

trying to add 45 different points to a map, but I just get OVER_QUERY_LIMIT returned, and no map. I am getting locations via a string search, then assigning the returned LatLng object to a new google Marker object String Search var geocoder = new google.maps.Geocoder(); geocoder.geocode( { 'address': x}, function(results, status) { if (status === google.maps.GeocoderStatus.OK) { var result = results[0].geometry.location; return result; } else { alert("Geocode was not successful for the following reason: " + status); } });

jQuery function is not working as i planned, DIVs just disappear on click

I have a script here, and it works amazing, except for one small detail. It basically runs as click function that fades in and out certain DIVs on the click of a link. The problem is, however, that when you click ANYWHERE on the page, it removes the DIV and leaves an empty content area until you click one of the links. Obviously this is a problem. I can't use the exact code I'm using for NDA reasons, but here is same setup I am using with just some plain text in the divs. Just click the links to see the functionality, and then click anywhere else on the page (in the div, in the white space, whatever) and watch the div just disappear. I'm know that that is what the javascript is calling, but I don't know how to disable the click in the divs so this doesn't happen. Also, how to do that so it doesn't disable the link that are within that div. Any help is greatly appreciated. This website is a life saver. This is the original code I got off of this site

running Javascript from an external site in C# application

I'm think about building a Silverlight C# Windows phone application for buses in Israel, and I have a basic question(or is it?). The bus site which I want to get the data from uses Javascript. You need to type in the city you want to get to, and it returns the list of stations in that city. I'd like to somehow "get" this page, type the code in, and get the results - all in C#. I'm pretty much lost on where to start from. How do I "get" the site code? how do I run the Javascript action that returns the stations, from within C#? is that even possible?

can javascript-based charting component be integrated into Flex/AS3 web app?

I'm relatively new to flex, and I'm developing a web app that needs to plot relatively large data sets (e.g. 20,000 pts divided among 8 separate curves) in a line chart. Flex built-in chart components render too slowly. Two part question: Would javascript line chart render faster than Flex line chart? If so, is it possible to use a javascript-based charting solution instead of flex component, within the Flex application? Or, is this an impractical (or crazy) idea? Anyone doing this out there? How simple or complex is it? I'm hoping it's relatively easy to integrate a pre-developed solution like EST JS, HighCharts, etc. to simplify development.