javascript

Access local file modification time in javascript

Is there a way to get the modification time of a file (either ctime or mtime should work) that is accessed locally through javascript. I want to go to file:///home/me/mtime.html and have the javascript tell me that /home/me/file.txt was modified 2 minutes ago or something. I understand that javascript has limited file access due to sec...

jQuery in-browser popup / dialog

What is the best (prettiest, easiest API, best performing, most maintainable, most customizable, etc) in browser popup / dialog plugin for jQuery? I've had good experiences with with Facebox, but I'm curious what else is out there. ...

How can I load a web page into a new window and inject JavaScript code into it?

Using JavaScript, how can i open a new window (loading, say, http://www.google.com in the process) and inject/insert this code into its body: <script type="text/javascript">alert(document.title);</script> I know how to open a new window, but i don't know how to add the script to the new window and run it: var ww = window.open('http:/...

Where/when we use JSON?

Could you please tell me, what is the use of JSON (in Javascript and PHP). when we need a JSON method. I read from the following link but, i didn't get any information regarding the JSON implementation on any project. http://www.json.org/js.html ...

How can I highlight certain options in a HTML select using jQuery

I have a jQuery reference to a HTML select list. I need to iterate the options and check to see if the text of the option matches a regex, if it does I want to add a cssclass to the option. How do I do this? var ddl = $($get('<%= someddl.ClientID %>')); Can I take advantage of the .each() function somehow? Example <select id="somed...

asynchronous loading images with javascript

Is there a method for showing a loading image for dynamic images that are generated using flickr? I have come across a way to do it as shown on the http://community.wacom.com/ site but I have not been able to get it to work, is there something simpler or does anyone have a better explanation than the originator of the technique from [blo...

Javascript scope problems

I have a bunch of javascript "classes" (Prototype) that make up the inheritance hierarchy of a web application I'm building. I've been trying to organize these classes into "namespaces": var UI = { Control: Class.create(KVO.Object, { ... }) } The classes are organized into separate files, so when I wanted to add a class to UI, I did t...

Null Object Problem

I am using this JS script for multiple country selection and I get an error from firebug. selObj is null [Break on this error] selObj.options[0] = new Option('Select Country',''); The relevant code is this: function populateCountry(idName) { var countryLineArray = country.split('|'); // Split into lines var selObj = document.getEl...

Count the number of nodes in an XML snippet using Javascript/E4X

Consider this problem: Using Javascript/E4X, in a non-browser usage scenario (a Javascript HL7 integration engine), there is a variable holding an XML snippet that could have multiple repeating nodes. <pets> <pet type="dog">Barney</pet> <pet type="cat">Socks</pet> </pets> Question: How to get the count of the number of pet ...

How do I parse a variable or multi value cookie in Selenium?

I am trying to parse a multi-value cookie using the Selenium IDE. I have this as my Tracking Cookie Value: G=1&GS=2&UXD=MY8675309=&CC=234&SC=3535&CIC=2724624 So far I have simply captured the full cookie into a Selenium variable with the standard StoreCookieByName command: storeCookieByName Tracking Tracking However I w...

Remove Session scoped managed bean on browser close

Hey all, In a JSF application, I want to remove a session-scoped managed bean when the user closes their browser window. I've used a link before that executes the following: session.removeAttribute("<nameOfManagedBean>"); This seems to do the trick nicely. However, I'd like this same code to run even if a user clicks on the "X" on th...

Creating elements in JavaScript

I have a lot of JavaScript code that creates HTML. For example: function Reply(postId) { if (!document.getElementById("reply" + postId)) { $("#root" + postId).after("<div id='reply" + postId + "'><textarea cols='70' rows='8' style='margin-bottom: 10px'></textarea><br/><span style='margin-bottom: 30px'><input type='button' va...

Jquery image preloader (how do i get the loading.gif to appear faster)

Hello Im attempting to get a Jquery image preloader to start the "loading.gif" and image preloading areas to start immediately on page open (if that's even a proper term) and I have been experimenting with javascript placement and other things, but it always loads a bit too late for my tastes. Here is the URL http://eleven23.net/beta...

Javascript onmouseover not working with doctype in firefox?

I am using the JavaScript onmouseover event for the menu on my website, but it does not work in firefox when I declare a doctype. And if i don't declare a doctype IE displays the page wrong. Here is the method that I used. loadImage1 = new Image(); loadImage1.src = "http://broken.gif"; staticImage1 = new Image(); staticImage1.src = "ht...

How would I bind this to the onclick event in JQUERY?

I have the following which i use in a traditional onclick event for a DIV tag How would I go about implementing this using jquery? $parameter = "onClick=\"selprice('" . $price_options_array[$price_counter]['price'] . "','" . $price_counter . "')" . "\""; I use the above and just add it to my div like so: <div class="price_row" <...

document.getElementById fails for single-tag DIV

I have 2 DIVs on an HTML page: <div id="divDebug" /> <div id="divResult" /> I have a script that hits a web service and fills them up with data: document.getElementById("divDebug").innerHtml = rawResult; document.getElementById("divResult").innerHtml = processResult(rawResult); Here's my problem: The above code works nicely in IE...

How to get crossSlide and lightbox2 working together on the same page.

(CrossSlide) (LightBox) This is my header: <script type="text/javascript" src="<?php echo ROOT.'sources/js/jquery.js'; ?>"></script> <script type="text/javascript" src="<?php echo ROOT.'sources/js/contentSlider/jquery.cross-slide.js'; ?>"></script> <link rel="stylesheet" href="<?php echo ROOT.'sources/css/lightbox.css'; ?>" type="text...

Why is reassigning Object.prototype not working?

Why this is not working? // this one works as I expected, when objSayHello() Object.prototype.objSayHello = function(){alert('Hello,from OBJECT prototype')}; // NOT working ! Object.prototype ={objSayHello: function(){alert('Hello,from OBJECT prototype')}}; objSayHello(); ...

Using jQuery UI drag-and-drop: changing the dragged element on drop

When using jQuery UI draggables and droppables, how do you change the dragged-and-dropped element on drop? I am trying to drag one DIV to another sortable DIV. On drop, I'd like to change the classes on the dropped DIV and change its innerHTML content. After reading various StackOverflow questions, my code looks like this: $(".column")...

Decrypting with private key from .pem file in c# with .NET crypto library

I know this is a similar question to this one but before I head down the Bouncey Castle route, does anyone know if its possible to load an RSA KeyPair from a .pem file (-----BEGIN RSA PRIVATE KEY-----) directly with the .NET 3.5 crypto library without having to go to a 3rd party or roll my own? ...