javascript

match pattern in javascript

How can i match a expression in which first three characters are alphabets followed by a "-" and than 2 alphabets. For eg. ABC-XY Thanks in advance. ...

PHP stylesheet print switcher problem revisited?

Okay I have this style sheet switcher which will only works if I leave out the media="print" from the style sheet link. I was wondering how can I fix this problem without leaving out the media="print" attribute. Here is the PHP code. <!-- Print Script --> <?php if (isset($_GET['css']) && $_GET['css'] == 'print') { ?> <meta name="robot...

Handling successive Ajax requests - JQUERY

Hi guys, I have a search textbox where upon keppress an ajax call is made to return search results for the inputted text. The thing is that this results in an Ajax call being made for like every single keypress - so if I wish to type in lets say airport I get 7 ajax requests each searching for a, ai, air, airp, airpo, airpor, airport re...

this, current context-when should I use in jQuery?

Hi All, I am not very sure with the use of "this" [current context] in jquery.What I know is- it prevents the dom from searching all the elements, it just work on that current element, which improve performance[correct me if I am wrong].Also I am not sure when to use this and when not. lets say, should I go for $("span",this).slice(5...

How can I make this repetitious jQuery less so?

I have 4 blocks of jQuery that look like this: $('#aSplashBtn1').click(function(){ $('#divSliderContent div').hide(); $('#divSplash1').fadeIn('slow'); return false; }); $('#aSplashBtn2').click(function(){ $('#divSliderContent div').hide(); $('#divSplash2').fadeIn('slow'); return false; }); $('#aSplashBtn3').click(function(){...

The Jquery displays $20.099999999999998 instead of $20.1

This is the Jquery code: function Totalprice() { var unitprice=$('#unitpay').val(); var quota=$('#readers').val(); var totalprice=unitprice*quota; $('#totalprice').text('$'+totalprice); } When the value of readers is 67 and the unitpay is 0.3, it calculates the total price and displays $20.099999999999998 , not $20....

jQuery: Possible to wait for $.get to finish loading before continuing?

The folowing script does not wait for $.get to finish loading the page before continuing with the loop: $.each(data.songs, function(index, val) { $('#nowartist') .append('song starting'); $.get("http://localhost/play.php", function(data){ alert('done'); }); }); data is a JSON object Any ideas or comments...

Loading Multiple JS variables up using RegisterStartupScript

I need to get multiple variables up into my JS code from my C# backend (ASP 2.0). Currently I use the following code string js; if (swapSize == null && VMWare == null) js = "var stackedUnknownExemptCheck = " + stacked.ToString().ToLower() + ";"; else if (VMWare == null) js = "var stackedUnknownExemptCheck = ...

The most concise way to submit javascript array to server?

I need to submit all selected JQGrid row ids to the server. var rows = $("#grid").getGridParam("selarrrow"); Then on the server I would like to do this. String[] rows = request.getParameterValues("rows"); Now what is the simplest way to submit rows to the server? Must I use POST? ...

Is it possible to post data from one url to another url?

This is my ajax code, For example URL 1 : www.text1.com and URL 2 : www.text2.com/check.asp Here i wand to post data from text1.com to text2.com.... Is it possible? <script type="text/javascript"> function ajaxFunctionSearch() { var xmlHttp; try { xmlHttp = new XMLHttpRequest(); } catch(e) { try { ...

How do I refresh/relaod a Chrome Extension?

I'm developing an extension in Chrome 4 (currently 4.0.249.0) that will show the user's StackOverflow/SuperUser/ServerFault reputation in the status bar. I've designed an options page to get the user's profile IDs and I save them to localStorage and read them well in the extension. It all works great.The problem is I cannot find a (progr...

Gears and Mysql sync

Hi, I am making an offline website that needs to sync every night with a server. Our employees work outside and sometimes underground and need to access the site for its database. But once home they must send us their findings. The first time they connect, I check with google gears if they have the sqlite database and if not I run a sc...

is window.open("", ... impossible with firefox?

Hello In firefox I have opened a locally stored file with the file:// protocol (file:///c:/temp/foo.html) foo.html contains Java Script which (among others) is supposed a new window without URL: var new_window = window.open("","", "height=100,left=50,width=200"); When this line is reached, Firefox displays this "Firefox prevented ...

javascript object arrays

Can we create a class with getters and setters and an array of objects of this class using javascript? ...

Free javascript star rating plugin

Could you suggest free javascript star rating plugin? ...

Javascript validation for invalid file type

I have a scenario wherein user is trying to view an invalid image file (for example an .dll file renamed to JPG extenstion). How to alert the user using javascript that this is an invalid file ...

Problems calling jQuery function from within normal JavaScript function

Hi. Tried looking at other solutions but they don't quite answer my question so here goes. The code below shows me declaring an anonymous function to run when the document is ready which contains another function relating to a plugin which creates a horrizontal accordion. That function takes in certain properties and one property, even...

re-firing a click event on a link with jQuery

hi i've got a page (asp.net) where I trap the click event of a link. i then do some dirty checking and present a dialog to the user, $(function() { var clickedLink; $('.checkdirty').click(function(event) { if(isDirty == false){ return true; } clickedLink = $(this); $('#di...

how to access inner span tag in jquery

Hi All, I have a HTML structure: <div class="mydiv">xx <span>test1</span> <span>test2</span> <div class="inerdiv"> <span>inner span</span> </div> </div> <span>test3</span> Now I want to apply styling to the span which co...

Eclipse project folder

I have the eclipse setup working pretty well for the java files in my code. But now I want to integrated the JS files also, leaving other XSLs/CSS files. Can I do that? One is adding all the folders and then manually delete the unwanted ones, but Is there some clean way of doing that? -Prtcl ...