javascript

Javascript asynchronous

I have some 3 methods. login(); isLogin(); reply(); function isLogin(){ FB.getLoginStatus(function(response) { if (response.session) { // logged in and connected user, someone you know } else { // no user session available, someone you dont know } }); } function login (){ FB.login(function(response)...

Why this is executed twice?

I have code like this: $(document).ready(function() { $("div #covert, div #coverb").height($(window).height() / 2 + 1); $(window).resize(function() { $("div #covert, div #coverb").height($(window).height() / 2 + 1); covconcr(); }); function covconcr() { $('div #covercon').css('left', $(window).w...

JavaScript error (Uncaught SyntaxError: Unexpected end of input)

I have some JavaScript code that works in FireFox but not in Chrome or IE. In the Chrome JS Console I get the follow error: "Uncaught SyntaxError: Unexpected end of input". The JavaScript code I am using is (updated code) Sorry miss typed. I get the error with this code: <script> //<![CDATA[ $(function() { $("#mewlyDiagnosed").hove...

css tabs with jquery

Hi All, I have this html file with some css styles now I am trying to create vertical tabs but when the page loads all the content is being displayed then if I select any particular tab only content of that tab is display but I am just worried when the page. How come all the tab content is being displayed? below is the code. <!DOCTYPE ...

Internet explorer 7/8 support of normal event passing, no need for window.event ???

It is common knowledge that Internet explorer does not support event passing to event handler functions like this one: function clickHandler(e) { // e is undefined in IE e = e || window.event; { For my surprise today, I found out that actually it does. I forgot to do this "e = e || window.event" trick in one of my functions, but i...

eval is evil issue

Using JSlint to validate my javascript. I am getting an error saying eval is evil! Why is this and is there an alternative I can use? Here is an example of where I am using eval and would like a workaround for it. I have an array like this: var Resources = { message_1: 'Message 1', message_2: 'Message 2', message_3: 'Message 3', mess...

Easiest Google Maps API (javascript/PHP)

I have an array of latitudes/longitudes and Descriptions that I want to display on a Google Map. Does anyone know of an API (or even better a tutorial) that describes a good way to accomplish this or something similar using PHP and/or Javascript? ...

Problem with AJAX Upload Script and MVC2

I found this ajax file upload script here http://www.phpletter.com/Demo/AjaxFileUpload-Demo/ Which is supposed to add ajax functionality to my file upload form <div id="dialog" title="Upload Image"> <% Html.BeginForm("Upload", "BugTracker", FormMethod.Post,new { id="uploadForm", enctype = "multipart/form-data"})...

document.getElementById('box').style.width="10px"; Doesn't work?

I cannot seem to get this script to work. Can anyone please help? The DIV's width is not defined. It just stretches across the whole page. <html> <head> <style type="text/css"> #box{ height:100px; border:3px; border-style:solid; border-color:#000; } </style> <script> document.getElementById('box').style.width="10px"; </s...

How do I disable or remove unnecessary form elements before an ASP.NET asynchronous postback?

I'm building a shopping cart page that could potentially contain dozens of separate items. Each item has a collapsible panel that contains several form elements that can be used to customize it. Most of the cart is wrapped in an UpdatePanel so that I can avoid a full postback when the user makes changes. When there are many items in the ...

Using jQuery to post JSON object to Spring 3 controller

I'm trying to POST a JSON object to a controller in Spring 3. I'm getting the following error: 2010-10-20 17:59:14,391 DEBUG [org.springframework.web.servlet.DispatcherServlet] Could not complete request org.springframework.http.converter.HttpMessageNotReadableException: Could not read JSON: Unrecognized token 'tilI': was expecting 'nu...

Control HTTP basic authentication using javascript

Hi, I'd like to check if a URL is protected by a Http Basic Authentication using javascript. Here is what I have so far : function showFailure(){ alert("FAILED ") } function showSuccess(){ alert("SUCCESS") } var myRequest = new Request({ url: 'http://localhost/access_protected_HTTP_BASIC', method: 'get', onSuccess:...

probability in javascript help?

Sorry, I'm new to JS and can't seem to figure this out: how would I do probability? I have absolutely no idea, but I'd like to do something: out of 100% chance, maybe 0.7% chance to execute function e(); and 30% chance to execute function d(); and so on - they will add up to 100% exactly with a different function for each, but I haven't...

Having jQuery string comparison issues...

I've got a fiddle going here to show what I'm trying to do. I have a table that is generated dynamically, so the columns could appear in whatever order the user chooses. So, I'm trying to get the index of two specific headers so that I can add a CSS class to those two columns for use later. ...

Trigger AJAX with jquery click event

I have two drop down menus, one of which I am trying to replace with radio buttons using jquery. The second box is updated via AJAX with new options any time the user makes a selection in the first drop down. I have successfully generated radio buttons that change the values for the first drop down but when the user updates the first dro...

How can I compare words using regular expression but ignore certain ones?

I have made a search engine and I am comparing a search string against a list of words. However I want to omit words like "How,do,i". So if the user search for "How do I find my IP?". If I have 3 other items beginning with How do I it wouldn't really be able to return a good relevancy. right now its setup (a-z0-9)+userinput+(a-z0-9) Wan...

ajax + servlet country state city list

I am trying to populate city, country and statelist using ajax, and servlets. Now I know how to get the XMLhttpRequest object. there is a standard mechanism to do that and depending on the cross browser compatibility, you do get a ActiveX or a xml object.. Then you send a request to the actionservlet, using xmlhttprequest.open() and you...

flowplayer hide video display for mp3 player

how can i hide video display, im just trying to display controlbar only for audios. btw im using javascript control bar http://flowplayer.org/demos/plugins/javascript/index.html ...

How do I prevent line numbers from appearing in content copied from ordered lists

Hi, I'm using a syntax highlighter, Google Prettify to be more specific, and I'm trying to select the content of the code but without the numbers of the li items, and when I say select I mean select with the mouse to copy and paste the code. I wonder if that's possible. If I'm not clear, please tell me and I will try to explain it bett...

Low-level javascript framework that abstracts away html/css?

Honestly, now when we have so many javascript features on the frontend I really wish javascript in the browsers could replace html and css entirely. We could deal with objects (structure + design + functionality) instead of html elements and css that style these elements. But since that is never going to happen, I wonder if there is an...