I am trying to work out some performance problems with some JavaScript I've been working on for a few days. One of the pieces of the functions is below:
var removeAddress = function(pk) {
var startTime = new Date();
jQuery('.add_driver select.primary_address:has(option[value=' + pk + ']:selected)').each(function(c, o) {
...
In a server-side Classic ASP file, let's say you receive a Request string containing malicious javascript like, "alert('HACKED');"
DIM foo : foo = Request.Form("foo"); 'Contains malicious javascript
and then later we're writing javascript to screen containing that value.
%>
<script type="text/javascript">
// some code
<%=foo %>...
This is the node-chat I'm inquiring about:
http://github.com/scottgonzalez/node-chat
How are the messages being passed to the server?
websocket comet ajax?
How does it work?
Is what it's using scalable?
Thanks.
...
I have a sprite that animates using a sprite sheet. He is only 16x16, but I want to scale him up to around 64x64 in all its pixel-y goodness!
The results are terrible, of course the browser is anti aliasing it. :/
Thanks!
...
I have one page with two types of forms. I have a single form of type A at the top, and then I have 1 or more forms of type B below it.
I use the Module pattern + jQuery to wire up all the events on my forms, handle validation, ajax calls, etc.
Is this the preferred/valid way to define a singleton, as in Form A, and a reusable object ...
paper.rect(0, 0, settings.width, settings.height, settings.radius);
Creates a nice rectangle with rounded corners. Is it possible to create a rectangle with just one round corner?
...
Hi.
How can i start javascript via ajax ?
html file
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" />
<title>FusionCharts 3.0 Dashboard</title>
<script language="JavaScript" src="../FusionCharts.js"></script>
<script language="JavaScript" src="../PowerMap.js"></script>
<script type="text/javascri...
Here's where I've been:
I made a PHP client call via soap to retrieve an array of data,
I successfully receieved and converted my array to JSON via json_encode,
I then echoed it back to my page.
Here's where I am:
I get back my array in this format...
{"MethodName":"ID,11|1|Item1,22|2|Item2,33|3|Item3"}
Here's where I want to be:
Using...
We have determined it's too difficult for us to maintain the bulk of javascript we need to write full-scale "single page" javascript "applications". Relying on programming conventions still has left us wanting... especially in the area of refactoring. For developers new to these projects, they find it very difficult to change anything be...
I've heard that some XSS attacks can be done by posting an image to a site that has javascript as the src attribute. Are there certain browsers that will protect me from this type of attack?
...
I'm interested in hearing opinions on how to efficiently organise JavaScript (and jQuery) in a largish web application project that could potentially see high traffic.
Things that concern me are:
Being efficient on the server
Being efficient on the browser
Keeping the codebase manageable
Lets assume that all authored JavaScript is k...
I have a page that calls window.print(); at the bottom of the page. I have no way of accessing the code around window.print(); Its generated by the server and I can't touch it. Basically because of IE I need to execute a bit of javascript before the print dialog comes up but after the page has loaded. I can't do this because as soon ...
I'm not sure why, as i've done this before and it worked fine, and i'm thinking it might be because of a browser issue/bug:
localStorage.setItem('foo', 'bar')
alert(localStorage.getItem('foo'));
I'm in Firefox 3.6.6 and it alerts "bar" but if I do:
//localStorage.setItem('foo', 'bar')
alert(localStorage.getItem('foo'));
I get NULL....
How to put the k var in the for-loop construction. I want more compact code, not like this one:
var k = 0;
for (var i = 0; i < arr.length; i++) {
if (arr[i] == 'x') {
k++;
}
}
...
I know in PHP we can do something like this :
$hello = "foo";
$my_string = "I pity the $hello";
output : "I pity the foo"
I was wondering if this same thing is possible in JavaScript as well. Using variables inside strings without using concatenation -- it looks more concise and elegant to write.
...
Is there any way to step through javascript touch eventhandlers running on iPad Safari? Specifically handlers for the touchstart, touchmove, touchend, and touchcancel events, not non-touch-related code which can be debugged in the (desktop) Safari user-agent simulator. Thanks
...
I am trying to get a value of the response
I check arguments.length and it says 1 and works
but when I do arguments[0].value or arguments[0].responseText it doesnt work...it says undefined....how do I get the values?
...
So I write a short function to remove members from an object that have falsy values:
for (var key in object) {
if (!object[key]) {
delete object[key];
}
}
A couple days later I check source control and someone has changed this to:
var newObject = {};
for (var key in object) {
if (object[key]) { newObject[key] = ob...
I'm generating images with PHP/GD Library for people to place on their websites. Similar to the "hit counter" services.
I am not able to pull the URL from the page that the button is loaded on.
The following only displays my url not theirs:
$_SERVER['SERVER_NAME'];
Am I going to need to pull the domain in Javascript?
...
I want to load a local .txt file and work with the content in javascript.
My local file is like C:\Users\Who\Desktop\file.txt
Thanks
...