javascript

Using global resource in JavaScript

I want to use global resource in my javascript code. Normally, when the code is inside the ASP code, I use <%=GetGlobalResourceObject("Resource", "MONTHS_SHORT1") %> and it works. But, when the javascript code is not inside the ASP code, for example in a folder as calendar.js, it does not work. How can I use the global resource in this...

JavaScript DOM : add an attribute to a <tr>

I want to create a JavaScript function that parses my HTML page, get the Table by it's ID, and after that, add a class attribute to each <tr> as if the line is the 1st, I'll add : class="line1" to the <tr> but if the line is the second, I'll add class="line2" to the <tr> How to do please ...

unload event when using master page.

In my project i have used master page.In one particular page , i want a function to be executed on page unload(javascript event) event of that particular page.To achieve this i have written $('body').bind('unload',function() { alert('hello'); } ); But this is not working.This function is not getting called when i m...

equivalent to window prompt/confirm/alert as pure JS/CSS solution?

I'm looking for an alternative to window.prompt(), window.confirm() and window.alert(). It's required for a complex web application where the window has an onblur() method and both IE and Safari incorrectly trigger this blur when raising a prompt (actually Safari crashes and IE ignores the prompt because the user hasn't allowed "scripted...

jQuery - can I "append" an additional parameter to every get/post request made

Hi, I would like to extend jQuery such that every post/get request made on the client side will have an additional parameter sent (always the same key : value). I need this to detect on the client side if the request was made through jQuery, since I have several js libs at work. The additional param is simply jquery : true. A typical re...

jQuery jFeed plugin working with the domain with www and without it

I use jQuery jFeed plugin to fetch rss feed from WordPress blog and show on the main page of the site. So, it works fine when I go to http://site-using-jfeed.com. But when go to http://www.site-using-jfeed.com, it doesn't load the feed and nothing is shown. I suppose there is something about cross-domain functionality. What can I do abou...

How can live search / search suggestions be implemented using Dojo?

I want to implement a 'live search' or 'search suggestions' feature in a web application that uses the Dojo Framework. It would be similar to the way Google and Bing searches display matches as you type: when you type in the search box, a list of potential matches appears below. Searches would be performed server side, with the results s...

javascript window closing after 15mins

Now, I have script that works, but only if time interval for closing is small (5mins works), but when I try to set timeout to 15mins, it fails every time. The script I'm using is: function openClose(){ my_window = window.open('http://www.somesite.com', "mywindow","status=1,width=1010,height=740"); //this should execute closepop...

minifying JS code structured in multiple folders and sub-folders

hi... im looking for a JS minifier... i dont need obfuscation... the project has over 100 js files, arranged into a directory hierarchy. i've googled around but couldnt find anything useful. i tried Dean Edwards JavaScript's Packer but got errors in the minified script. my requirement is simple.. i need a software to minify all these...

javascript detecing framebusting code

I'll preface this by saying that I understand the security concerns behind the tendency to include framebusting code (that is, code designed to prevent a site from being shown within a frame) in sites, so I have no interest in trying to circumvent it. That said, since it rather ruins the user experience on my site, is there any way to d...

Why does the sum of 2 parseFloat variables give me an incorrect decimal number

If I have this little function: <script type="text/javascript"> function printFloat(){ var myFloatNumber1 = document.getElementById('floatNumber1'); var myFloatNumber2 = document.getElementById('floatNumber2'); alert(parseFloat(myFloatNumber1.value) + parseFloat(myFloatNumber2.value)) } </script> <input type="text...

How to run batch process?

Hi, I am working on News means I need to include online yahoo news title and description in my page. For that I have to create 1 batch file , but the problem is that how to create that batch file which will call the yahoo online news inside that file then how can I include that file in my page? Thanks ...

How to sort lines with Slickgrid?

I'm using Slickgrid but I'd prefer not to use slick.model.js. How can I write grid.onSort to sort the lines of my data set? My code uses the standard template: $(function() { var data = [ ... ]; grid = new Slick.Grid($("#myGrid"), data, columns, options); grid.onSort = function(sortCol, sortAsc) { sort...

how to open the save as dialogue box with javascript

Hi experts, how can I programm a button so that when clicked should open the save as dialogue box? Put simply, how can I save a file on the local machine using javascript or php? I really don't know how to go about it. Thanks in Advance. EDIT: Thanks for the quick response. I have a table that I have displayed on a web page, and a b...

Select all options in select

I have a multiple select. How can make, that all options will be selected always? Or how make a selecting all options ob submit. I have only class of select(not ID). ...

A few questions about JavaScript basics - $, "is not a function"

Being fully self-taught without actually reading up on JavaScript (It's my job now, believe it or not) there are a few things I accept but don't understand. The first one is the dollar sign. As far as I use understand it, it's a shortcut to document.getElementById(), but if I log $ and document.getElementById() to console - Only $ retu...

How to see text from one text field in another text field?

Hello all, I have a tricky questian this time...for me anyway.... clarify: i am using a virtual keyboard that has to work on deferent text fields, and deferent pages, every time i click on a text field it sould pop up and every key i press i need to show on the text field....the problem, as every one knows, is to bind a deferent text f...

get elemet valu and add them (parseFloat seems to fail)

Hi, i have the code above var element1=$("#element1").val(); //the element1 value is 12.60 //html code for this element <input id="element1" value="12.60" /> element1=parseFloat(element1).toFixed(2); var element2=$("#element2").text(); //the element2 value is 1.00 //html code for this element <span id="element2">1.00</span> elemen...

MultiColumn HTML List Box

Is it possible to create a List Box, with List Items in Multiple Columns? I am aware of the alternatives, but I am wondering if this is possible in <select> ...

same origin policy in external js file

if in the website http://www.mysite.com there's an external js file added as <script src="http://www.yoursite.com/new.js"&gt;&lt;/script&gt; within the http://www.yoursite.com/new.js js file, there's an ajax call to a script in http://www.yoursite.com/new.js in such a case will there be the same-origin policy security problem, as i...