javascript

Javascript Closure and Data Visibility

I am trying to wrap my head around the idea of classes, data visibility and closures (specifically in Javascript) and I am On the jQuery docs page for types, it mentions that closures are used to hide data: The pattern allows you to create objects with methods that operate on data that isn't visible to the outside—the very basis of o...

Grant SeServiceLogonRight from script

I need to be able to grant rights to a user from a script (a batch file or JScript file). In particular, I want to grant SeServiceLogonRight to a particular domain account. I can't use NTRights.exe (not available on all target OS's), and I'd like to avoid having to write an executable in C just for this. Is it possible to do this with st...

Using Javascript in an element with injected HTML in jQuery

Hi, I'm trying to reference some javascript files in a remotely loaded (injected) HTML file via jQuery's .load() function. The javascript files I'm attempting to utilize in the loaded HTML file are already included in the loaded HTML's parent HTML page. Initially, I thought that making references to these files in the loaded HTML woul...

Best approach for including bits of Javascript on individual pages in Sitefinity.

Frequently, I just want to drop a bit of jQuery on an individual page. Given my early understanding of Sitefinity, I think... I can't easily put JS in the <head>. I could put JS in a Generic Content control, but then my JS is sitting inline in the <body>. Maybe I need to relax, but I don't usually like to put much JS in the <body>. ...

how to detect a click of a grid inside an iframe?

I have to put a grid inside a iframe. I select a row then the detail is loaded in the main page hosting that frame. How to do? An image is better than 1000 words. I want to reproduce a master-detail view like wufoo. The "black" grid is inside of the iframe. So the grid is always on top. Selecting a row, the detail page will be loaded on...

Jquery working in Firefox but not Internet Explorer

I'm using the jQuery Cycle plugin (malsup.com/jquery/cycle/) on this page: http://artandculturecenter.org It works as expected in Firefox and other browsers, but NOT in any version of IE that I've tried -- browser displays all the divs rather then cycling through them. I'm assuming this is because jQuery isn't working/loading at all bec...

JQuery apply bind to all children

I have: $(document).ready(function(){ $("#eventsContent").children().each(function(){ $(this).bind("mouseenter", function(){ $(this).css("background","#F5F5F5"); }); }); }); I have tried this a couple different ways, but this is the jist of what i've done. I have a container div with numerous divs within it. I want to bin...

Password Strength Meter

I have a situation where I would like to be able to rate a users password in the web interface to my system, so that before they hit submit they know if they have a bad password. Key Requirements: Must be able to rate the password, not just pass/fail. Should disable the form if the password is below a threshhold, so the user can't sub...

Best way to make a cross-site request with JavaScript?

Until the cross-site XHR API becomes widely supported, what is the best way to make a cross-site request through JavaScript? I've been using iFrames, but those can get a bit messy. Is there a better way? (By better, I mean easier to work with.) Also, I'd prefer to see pure JavaScript code, not a framework such as jQuery, etc. I'm using ...

Should I use window.navigate or document.location in JavaScript?

What's the preferred method to use to change the location of the current web page using JavaScript? I've seen both window.navigate and document.location used. Are there any differences in behavior? Are there differences in browser implementations? ...

Collecting every word in document DOM tree with javascript

Suppose you have a large document with around ~7000 words. I need to send all data to server. I have no chance to use jquery, prototype etc. It should be clean OO javascript. Sample page would be json russian page I will exclude all tags and html markup from words. My question is; 1. How can i collect/harvest all (utf8) words from do...

Array.prototype problem

I was working on an AJAX-enabled asp.net application. I've just added some methods to Array.prototype like Array.prototype.doSomething = function(){ ... } This solution worked for me, being possible reuse code in a 'pretty' way. But when I've tested it...

What Javascript security techniques and issues should be part of a programmer's skill set for solid web development?

What Javascript security techniques, issues, and limitations should be part of a programmer's skill set for solid web development? ...

How do you convert a JavaScript date to UTC?

Suppose a user of your website enters a date range. 2009-1-1 to 2009-1-3 You need to send this date to a server for some processing, but the server expects all dates and times to be in UTC. Now suppose the user is in Alaska or Hawaii or Fiji. Since they are in a timezone quite different from UTC, the date range needs to be converted...

How can I make an HTML table sortable with javascript without loading data via AJAX?

How can I make a table sortable using javascript without loading data via AJAX? More specifically, I'm looking for a solution that gives me the following: Works on a plain old HTML table Makes columns sortable using a natural comparison Is agnostic of server-side technology (should be portable regardless of whether the tables are bein...

Browser refresh on AJAX with script tags in the response

I'm having some issues with a jQuery AJAX call. My code works fine when I request a page with no javascript in it, but when I have script tags in my code, things start to get weird. It seems that any script tags referencing external URLs cause the browser to redirect. In firefox, the page goes blank. In safari, the page clears and loads...

Finding difficult when i post xml document in my site

hi friends I am using a php and javascript codes to post my xml to a url. and i have posted it successfully from my local server. but when i tried it in site, i cant post my xml document to that url. what will be the reason for it??? why this is happening, working perfectly in my local server but nothing is happening in the site. i...

Best Technologies for AJAX Web Development

Hey Everyone, I have some experience in AJAX development, mostly on .NET and MooTools. However, I want to learn more and see what others out there thought about the various other options available. I am looking more for advise about the front end. The back end, I will most probably be coding up in .NET using c# and WCF services. Please...

How to prevent Ajax/javascript result caching in browsers?

How to prevent browsers from caching Ajax results? I have and event triggered Ajax script the displays results only when the browsers data has been cleared. Tested in IE6 and Firefox 3.0.10 ...

Splicing a string indexed array in JavaScript

Gday All, I have a string indexed array that I would like to remove an item from. Consider the following example code: var arr = new Array(); arr[0] = "Zero"; arr[1] = "One"; arr[2] = "Two"; arr.splice(1, 1); for (var index in arr) document.writeln(arr[index] + " "); //This will write: Zer...