javascript

Visual Studio Web Deployment project auto compress js and css

Is there a way to make the web deployment project automatically compress js and css files when building it? how can I automate this process? ...

jQuery sortable obtain 2 elements being swapped

Hi, I cannot find out how to obtain destination element with jQuery UI sortable. $("#pages").sortable({ opacity: 0.6, update: function(event, ui) { var first = ui.item; // First element to swap var second = ???? // Second element to swap swapOnServer(first, second); } ...

Display local time from utc time stored in sql database on asp.net app

I've got times saved in a sql database in utc format. I'm displaying those times on a gridview, however they are still UTC format. I'd like to convert them to the client's browsers local time. The problem is that although I can get the timezone offset that is only for the current date/time. That offset could change if some of those d...

why my code that write by me is upper,when keyup,thanks

$('#a').keyup( function(event){ alert(event.keyValue) } ) but error,coz 'keyValue' is not undefined, how do i get the keyValue when the event keyup??? i use jquery. thanks i do this: $('#a').keyup( function(event){ alert(String.fromCharCode(event.which)) } but it alert the value of upper ex: i alert I l ...

Why always UpperCase in my code?

<script type="text/javascript" src="jquery-1.3.2.js"></script> <input id=a type="text" value='sss'/> <script type="text/javascript"> $('#a').keyup( function(event){ alert(String.fromCharCode(event.which)) }) </script> you can test this code in your brower, and it always alert UpperCase of a charcode. ...

Populating child dropdownlists in JSP/Servlet

Suppose I am having three dropdownlist controls named dd1, dd2 and dd3. The value of each dropdownlist comes from database. dd3's value depends upon value of dd2 and dd2's value depends on value of dd1. Can anyone tell me how do I call servlet for this problem? ...

How to write unit test to assert the value of a jQuery element

I am using jQuery 1.4.1 and here is a simple code. buildCol1: function() { var col = $('<select />', {className: 'col1' }).append($('<option />')); return $('<td />').append(col); }, I am using qunit . In this case the method call is returning a jquery element. Since I am writing a test I should have something like s = "<td><sele...

access outer "this" in Javascript sort method

I have this code: function some_object(...) { this.data = {...}; this.do_something = function(...) { var arr = [...]; arr.sort(function (a, b) { return this.data[a] - this.data[b]; }); } } However it's not working I think because this cannot be accessed in sort - another this is seen there for s...

Detect a finger swipe through JavaScript on the iPhone and Android

How can you detect that a user swiped his finger in some direction over a web page with JavaScript? I was wondering if there was one solution that would work for websites on both the iPhone and an Android phone. ...

jquery selector problem in hierarchical expanding/collapsing tree

I'm trying to build a screen that will be a hierarchical list of bookmarks, grouped into categories. The categories can be expanded/contracted to show or hide the bookmarks for that category. Right now I'm just working on the UI and using jquery for the first time (and loving it). The methodology I'm using is sorta like accordion but ...

how to make a flash swf object occupy browser completely?

i have a swf file of width 1000 and height 700. i want to show the swf file in full screen of the browser it self (not like videos plying full screen). i tried like the following 1) get user screen width and height using java script using the functions available (screen.availHeight and screen.availWidth) the screen size is available ...

Calling a method in an object, from inside a different object?

Is there anything particularly bad about doing something like this in Javascript: myapp.someObject = { this.doSomething = function() { // stuff happens . . . // myapp.someOtherObject.doSomething(); } } ...That is to say, calling a method in another object, from inside an objec...

JavaScript/Prototype.js: Delete property from JSON object

var myJsonObj = {"employees":[{"name":"John", "lastName":"Doe", "age": 55},{"name":"Jane", "lastName":"Doe", "age":69}]}; How can I delete myJsonObj.eployees[1] ? Thank you :) ...

javascript call function in another file

Hello, I have a WSH javascript containing a function. I want to call that function form another javascriptfile . How can I do that ? Thanks, ...

why i can't alert this string which is return from django render_to_response.

django code: return render_to_response(template_name, { "form": form, }, context_instance=RequestContext(request)) and html: <script type="text/javascript"> var a='{{form}}' alert(a) </script> it's error is 'unterminated string literal', and i see this in firebug : <script type="text/javascript"> ...

How to get type of input object

I want to get type of input object but I alway got "undefined". What is missing it this code? var c = $("input[name=\'lastName\']"); c.val("test"); alert(c.type); My form <form action="formAction.jsp" method="post"> FirstName <input type="text" name="firstName" id="firstName"></input><br/> LastName <input type="text" name="l...

Javascript/ JQuery syntax not too intuitive?

Is it just me or do you feel the same? I find JavaScript and JQuery (especially the classical JavaScript) syntax very hard to follow, despite using these for a while. However, I do find PHP, C syntax very easy to follow and understand. Do you feel the same? ...

Looking for a tutor to ease the OO learning curve

I'm not sure if I'm asking this in the right place, so apologies if I am not. I have been studying OO javascript in a variety of texts, but I am finding it difficult to make the jump from theory to practical design problems. I am hoping to find a tutor who would be willing to spend a little bit of time looking over a small chunk of m...

Getting ajax history

Is it possible to get a history of all past ajax calls from the browser? If not, are there any ffx plugins or similar that will store all your ajax request in a similar way to the normal browser history? ...

javascript:void(0) considered harmful

Can anybody tell me or point me to some resource which explains why using javascript:void(0) in hyperlinks is harmful (especially in IE6)? ...