javascript

how to make a sleep in javascript?

Does anyone know how can I make a sleep in javascript before next line been read by the system? example: 1 var chkResult = Validation(); 2 //sleep here for for 10 sec before the next line been read 3 4 document.getElementById('abc').innerHTML = chkResult; For this example, how can I make the javascript sleep/wait in line 2 fo...

Get first date of week from provided date

I want to pass a date object into a function and determine what the first date of that week was. Example: If I pass in today's date (2009/06/24) I want the function to return what the first date of this week was, i.e. Sunday's date was 2009/06/21 so it must return that. Anyone know of any standard javascript function that does that? Th...

Weird Javascript Behaviour: Floating Point Addition giving the wrong answer

Possible Duplicate: Is JavaScripts math broken? This seems really stupid, but when running this, it will display 7.300000000000001 instead of 7.3 <script language="javascript"> function buttonClicked() { var mySum = 1.1 + 1.1 + 1.1 + 0 + 4; alert(mySum); } </script> What would cause this? I have th...

Disable the text box from being accessed by the user in calendar_date_select

I have a date picker <%= calendar_date_select_tag "from_date", nil, :embedded => false, :year_range => 10.years.ago..0.years.ago, :valid_date_check => "date < (new Date()).stripTime()" %> The problem is as it is not embedded a text box appears and it makes the users to change it. How can I make it off so that only this datepicker can ch...

Split java strings in Rhino

I'm trying to split a java string in a Rhino javascript program var s = new java.lang.String("1 2 3"); s.split(); which give me the error js: Can't find method java.lang.String.split(). The Rhino docs mentioned that all the javascript String.prototype methods (like match, split, etc.) are available on java string if they're not al...

Php Javascript alternative for jquery grid

Hi, I want an alternative to a jquery grid for crud operations in php. I want to use a simple table with facilities such as searching, sorting an pagination. Is there any library for this? Can i use prototype.js for achieving this? Please guide me. ...

Date difference in Javascript (ignoring time of day)

I'm writing an equipment rental application where clients are charged a fee for renting equipment based on the duration (in days) of the rental. So, basically, (daily fee * number of days) = total charge. For instant feedback on the client side, I'm trying to use Javascript to figure out the difference in two calendar dates. I've search...

Check All Checkbox with Pagination

Hi, I currently have a report with pagination, that displays 20 records at a time. In total, there are 600 records. Within this report, I also have a checkbox column for every record. Based on this, my queries are as follows: 1) I want to incorporate a "Check All" feature, so based on my scenario which displays 20 records (total of 60...

DLL as `src` of `<script>`

I was browsing the source code of some website, and noticed a dll file being used as the src of a <script>. (view-source:http://www.yellowbridge.com/onlinelit/baijiaxing.php) It was something like: ` Several questions: I didn't know a <script> could be anything besides js. What else can it be used for? Can you point me in the direc...

Writing a non-GUI bot using Mozilla Framework

Hi, I'm looking for a way to write a non-GUI bot using Mozilla Framework. The bot should be able to work like normal browser (automatically download relevant JS files, make XMLHTTPRequests, run JS operations, modify DOM), except no GUI will be needed. I wonder if it is possbile to build XULRunner without X, GTK/KDE (without any GUI dep...

How do I use callbacks to load a JavaScript function inside a ModalBox?

I am using Wildbit's ModalBox to load an external page in a modal window. I'm trying to get a datepicker JS script to run inside of this modal window, but it just...won't work. I know ModalBox has callback functions, which allow you to execute a function after the modal window has loaded; for example: Modalbox.show(url, {afterLoad: fun...

How to add an object before another object as part of a bigger object...

For my web-application I would like to add an object before another object inside a self-defined object.... I did find the insertBefore method, but it only applies to DOM objects. The object looks like: objTemplate[0].objEntry; objTemplate[1].objEntry; <= add objEntry here objTemplate[2].objEntry; objTemplate[3].objE...

How to drag from browser area and deposit to the explorer area?

Sometime ago I was facing the problem the other way around: how to drag an item (folder/file) from an explorer window (be it windows explorer, linux nautilus etc.) to the browser window - that is, the drag starts in one application and ends in the browser. Since I had control over the browser, I was able to intercept the dragend event: t...

Auto submit form after x mili seconds of inactive keyboard

In my form I have a set of input boxes where a user can input a value. On change of one of these boxes, the form automatically gets submitted. The problem now is however that a user stays in the last field, takes the mouse and presses the OK button (of another form) without leaving the textbox first. The change event doesn't get trigger...

JavaScript animate resizing div

I'm trying to put a small animation on a page. I've got 2 divs side by side, the second of which has its content called via Ajax, so the div height varies without page refresh. <div id="number1" style="float:left; padding-bottom:140px">Static content, 200px or so</div> <div id="number2" style="float:left">AJAX content here</div> <div st...

Is there an easy way to embed a Javascript interpreter in a C# application?

Possible Duplicate: Embedding JavaScript engine into .NET (C#) Is there an easy way to embed Javascript in a C# application? I want to make my C# application scriptable. I have used Lua for this in the past but would like to use Javascript in this instance. LuaInterface is a nice C# wrapper for the C Lua API and it made i...

Ajax request with prototype - what is transport if not only responseText?

This is an example code from the prototype site. var url = '/proxy?url=' + encodeURIComponent('http://www.google.com/search?q=Prototype'); // notice the use of a proxy to circumvent the Same Origin Policy. new Ajax.Request(url, { method: 'get', onSuccess: function(transport) { var notice = $('notice'); if (transport.respons...

ExtJs Window doesn't render

Hi, Please tell me why my window doesn't render. Below is the javascript that i am using <link href="/Scripts/ext/resources/css/ext-all.css" rel="stylesheet" type="text/css"/> <script src="/Scripts/jquery/jquery-1.3.2.min.js" type="text/javascript"></script> <script src="/Scripts/ext/adapter/jquery/ext-jquery-adapter.js" type=...

How to disable (View Source) and (Ctrl + C ) from my site

Hi guys Is there a chance to disable these two things from my site? (View Source) and (Ctrl + C ) please, give me few minutes from your time and help, i'll be much more appreciated thanks in advance ...

Is it possible to get the type of a .Net object using javascript?

I wrote a web application using ASP .Net MVC. One of the application's function is to return a list of objects, using json, to the webpage. However these objects are of different types. How can I determine the types of these objects using javascript? ...