javascript

How do I validate the size of a file using JavaScript?

when upload button clicked on page... want to check filesize selected in fileupload control and stop postback of upload button if file size exceeds... what are the ways to do this using jquery/javascript? ...

Can anyone provide sample source code for xml parsing using photoshop javascript?

Here is a sample of a simple xml file I want to parse using photoshop javascript: <Pgen> <renderSettings> <imageWidth>1000</imageWidth> <imageHeight>600</imageHeight> <SAA>16</SAA> <bgColor>E1E1E1</bgColor> <filePrefix></filePrefix> <suffix>.jpg</suffix> </renderSettings> <coverPage> <template>//TEMPLATE/Product.psd</template> <title>20...

Where is the node.js file in the stack trace located?

Obviously, I'm pretty new to node.js. I'm attempting to debug a node.js application and I see node.js in the stack trace. I would like to put some sys.puts calls in there, but I cannot locate the node.js that is being run by my server. Is there a way to tell where node.js is located? Is there an equivalent to Ruby's __FILE__ in node? ...

Get values of textareas generated dynamically

In the below code,the textaraes are generated dynamically ,now how to get these values for validations in valid() function.. <script> function valid() { //get all textarea vales for validation } function add(col_det) { var row = '<tr>'; row += '<td>'; row += '<textarea rows = "8" cols = "8" class = "input" W...

Making links clickable in Javascript?

Is there an simple way of turning a string from Then go to http:/example.com/ and foo the bar! into Then go to <a href="http://example.com"&gt;example.com&lt;/a&gt; and foo the bar! in Javascript within an existing HTML page? ...

Removing an Element on Certain Location

Let's say the window's location is on htt://stackoverflow.com/index.php, I want to remove an element in the index page with jQuery. This is what I have and it's not working: $(document).ready(function() { var location = window.location; var locQuery = /index/i; if (location.match(locQuery)) { $('.someClass'...

Calling a non static method in Server Side by a Client Side Function

I can get an object from the server side by using static receive callbackresult methods from server side. But I want to run a non-static method in my page which populates an ajax accordion by calling a client side function. The object I am calling from server side is a complex object which I can't use in client side if I get it by call...

Adding watermarks to textarea

How to add watermarks like "Enter textarea" for a textarea. <textarea rows = "8" cols = "18" border ="0" class="input" style="border: none;" WRAP id="details" name ="details"></textarea> Thanks.. ...

jqGrid dynamic event

Suppose I have the following (shortened for simplicity): jQuery("#grid").jqGrid({ ... ondblClickRow: function() { // I want to define this function dynamically at run time } ... }); How to I bind ondblClickRow event outside of the grid Deceleration. For example in jQuery I would normally do $('#grid').bind('ondblClickRow', funct...

Changing CSS on the fly in a UIWebView on iPhone

Let's say I'm developing an iPhone app that is a catalogue of cars. The user will choose a car from a list, and I will present a detail view for the car, which will describe things like top speed. The detail view will essentially be a UIWebView that is loading an existing HTML file. Different users will live in different parts of the wo...

Difference in Months between two dates in JavaScript

How would I work out the difference for two Date() objects in JavaScript, while only return the number of months in the difference? Any help would be great :) ...

Queueing Effect.Parallels in Scriptaculous doesn't work

Each block of animations, grouped in an Effect.Parallel, runs simultaneously. That works fine. Then, I want each of the Effect.Parallels to trigger sequentially, with a delay. The second block doesn't wait its turn. It fires when the function is run. Why?! ///// FIRST BLOCK ///// new Effect.Parallel([ new Effe...

jQuery Cycle plugin IE6/7 issues

I've implemented a slideshow using the Cycle plugin, which is working in all browsers except IE6&7, where the images just show up in a list, and the #page_copy div is not hiding. I've been going through the code all day without any luck, and not exactly sure how or what I should be looking for. What would be the best way to go about de...

Google Maps API - Event Listeners

Is it necessary to remove Event listeners in when using google maps javascript api? "assume that code is working fine" In other words do even listeners hinder website performance in such a way that one should ALWAYS remove/minimized unused listeners. Thanks ...

How to set labels inside textfields for username and password ?

I have a login form for my website. This login form have two text fields, username and password. Currently I am placing labels(username, password) just before textfields. But now I want to removed these two labels and want to show text(username, password) inside textfield. When user focuses on these textfields then texts should be remove...

jQuery, unable to store data returned by $.get function.

I am trying to turn div#sidebar into a sidebar in my app. My code looks like the one below. $('#sidebar').userProfile(); jQuery.fn.userProfile = function() { $.get('/users/profile', function(data){ $(this).html(data); }); }; It didnt work because, I found the this (inside the $.get function) here contexts to the get request and not...

Javascript hide/show classes with checkbox

I am just learning javascript, so please bear with me! I want to be able to use checkboxes to choose to hide/show div classes (to basically filter the amount of info being shown). It is done in this... but I'm try to figure out something much simpler (since I don't need to dynamically generate the checkbox options.) I came across this...

Does changing window.location stop execution of javascript?

When writing server-side code you need to explicitly stop execution after sending a "Location: ..." header to the client or your code will continue to execute in the background. But what about when you change window.location in a client-side script? Does this immediately stop execution of the current script or is it up to the programme...

Android Webview + WebViewClient + javascript + hardware input

I've a webview which should distinguish between internal site links and external links. I achieve this behavior by adding a html anchor named "#external" to every link url which contains html-attribute target="_blank" with the help of javascript and checking the urls with WebViewClient's shouldOverrideUrlLoading This solution work...

how to create run time element? where i am doin wrong help....help.....

new Ajax.Request('Handler.ashx', { method: 'get', onSuccess: function(transport) { var response = transport.responseText || "no response text"; //alert("Success! \n\n" + response); var obj = response.evalJSON(true); ...