javascript

Automatically convert css to mozilla specific css

If my css is: border-bottom-right-radius: 20px; is there a JavaScript library that will convert it to -moz-border-radius-bottomright: 20px; automatically if it detects a user agent that is a mozilla browser, example: Firefox? ...

JavaScript -recommended testable pattern

Hi -I read about 2 JavaScript testable patterns, but I am not sure how they differ and which one should I use. Pattern 1: function class () { this.propertyA = null; this.methodA = function() { alert(''); } } var object = new class(); object.methodA(); Pattern 2: var object = (function() { var propertyA = nul...

Problem with form submission in JQuery popup

I have a .NET powered website, that has a sign-up box form already. I'm using the JQuery dialog to popup a window, on which I also have a form. That form will not submit using a standard submit button. Nothing happens. I use the following Javascript to allow my main page signup form to work properly: <input onclick="this.form.action=...

jQuery Tools Scroller with autoscroll & jQuery Colorbox

I have implemented a simple scrollable photo-gallery with jQuery Tools. I then attached the autoscroll behavior to the jQuery tools scroller to create a photo slide-show. Then I attached the jQuery colorbox to the photo slide-show to provide a larger version of the images. I'm running into the following problems. I hope I can explain...

jQuery Datalink not working with object methods

Hi, I have a javascript object with several properties. The object also contains an instance method that returns the result of a calculation on two of the object's properties. I'm using the new Jquery .link() plugin (http://api.jquery.com/link/), to update the UI and form elements with the object property values and vice versa, whenev...

How to prevent multiple ajax requests when multiple browser windows are open.

I have been working on having a instant messaging system on a website(kind of like Facebook and Gmail). I have javascript poll the server for new messages. If the user has multiple instances of the site open is there any way to prevent each one from making requests? ...

I can't add html elements dynamically in IE

I have this javascript code to add html elements dynamically. It works perfectly in chrome but it doesn´t work in IE, nothing happens, just seems to add spaces that are maybe divs. Please Help Me!! <script type="text/javascript"> var numero = 0; evento = function (evt) { return (!evt) ? event : evt; } addCampo = function () { ...

A way to get relative paths to work using subdomains?

When accessing a page through a subdomain, all includes and relative paths break (even though the directory structure on the server should allow for the relative path to find it). What's the best way to have files on multiple subdomains access central resources (without using absolute paths)? An JavaScript example: m_url : '../code/ph...

read http response from iframe src using javascript

We have a scenario where our iframe loads external src. There could be url response error. Since we are unableto read the response code we are unable to stop the processing. We have a code some thing similar to We should not be using ajax since we face some issues with cross domain functionalities Please help.... ...

JavaScript flowchart / flow diagram lib

Are there any javascript libraries for client-side rendering and manipulation of flow-charts? My preference would be for jQuery, but I'd settle for others. This question has been asked before, but not for a couple of years so I'm hoping there's a more positive answer now! ...

Event Time displaying incorrectly for my Facebook event (submitted via Javascript)

I am currently writing a site that interacts with Facebook and creates events for users. I am using Javascript to submit the event, which is submitting successfully. The problem is, the time that is displayed on Facebook is way off from the time I am submitting. Here is my code: var event = { start_time: '{{ show_time.start_time|...

jQuery / Javascript - loop

I want to make it so when I click somewhere in my website, the background changes. I have three backgrounds, and I want to make a loop of them. $(document).ready(function() { $('body').click((function(){ return function() { if (counter == null) { var counter = 1; } if(counter == 3) { $(this).css("background-image"...

Rails 3 Conditional Inclusion of Javascript files

I'm trying to figure out the best way to include the following in my head in rails 3: <!--[if IE]><script language="javascript" type="text/javascript" src="/javascripts/excanvas.min.js"></script><![endif]--> As you can see, I just want that javascript file availabe to IE... so perhaps I shouldn't do it this way at all... I'm open to ...

JQuery issue by IE

I get an error by following code: jQuery.post('/user/result/generate',{ 'id': getHidden() }, function(html) { $('#result').html(html); }); error: TypeError object doesn't support this property or method this code works fine in FireFox, but not in IE. How can I fix this? p.s the function g...

issue with replace() method in javascript when replacing spaces

This is the function I am working with: function replaceH1s() { $("h1").each(function(){ h1name = $(this).text(); stuff = h1name.toLowerCase().replace(' ','-'); $(this).html('<img src="/assets/image/h1_' + stuff + '.png" alt="' + h1name + '" />'); }) } I can't figure out for the life of me why this function replaces th...

508 compliance and javascript

I run a site (ASP.NET) for a company that is in different counties, based on the link the user clicks on the landing page all the tags on the page gets a string of the county added to the end of it href tag. (ex. www.somedomain.com/home.aspx?county=x ) I then use the querystring to provide county specific information. Is this out ...

Move cursor to next field with Javascript

Basically the function below is a listener for a change in selection of one dropdown. I want the cursor to move to the next field on the page as well the below function is executed. How do I do this in Javascript? The next field on the page is an ExtJs textbox. function changeVehicleCondition() { var ValuationSource = getCurren...

why the third option is better than regex?

I think regex is pretty fast and the third option is confusing. What do you think? http://jqfundamentals.com/book/ch09s12.html // old way if (type == 'foo' || type == 'bar') { ... } // better if (/^(foo|bar)$/.test(type)) { ... } // object literal lookup if (({ foo : 1, bar : 1 })[type]) { ... } ...

Fb.ui only shows up after second click.

Hi, I am creating a Facebook application which should allow the user do post something on his/her wall. The main actions take place within a Flash movie. When the user is finished the Flash movie uses ExternalConnection to notify the JavaScript. The JavaScript now display a link, that has been hidden all the time and attach a onClick ev...

Isolate CSS in element from rest of page

I am displaying HTML emails in a page and often those come with general style information that I need to isolate from the main page. For instance, if the email looks something like this: <style type="text/css"> body { background-color:#000; } </style> <div> email's content here <div> I end up with a black background on the whole pag...