javascript

What causes Javascript to act differently on different machines?

I just added a feature to a forum and while most users see and use it, a small number of people report strange behavior. I thought the problem might be due to browser caching and a ctrl+F5 solved it for some, but some can't fix it. (It's a simple editor button.) I feel stupid even asking this but is there any way JS could not work on so...

Batch translating with Google Language API

I am trying to utilize Google's AJAX Language API to translate each value in an array. for(var n=0; n < mytext.length; n++) { google.language.translate(mytext[n], originalLanguage, newLanguage, function(result){ if(!result.error){ document.getElementById("caption") += mytext[n]+" has been translated to "+result.translation; } ...

jQuery, Web Application Framework?

For the longest time I've used jQuery to hack together web sites. Now I'm interested in making a web application (one page load for the entire site to function, like Gmail). Are there any jQuery Frameworks or practices that I can leverage to build my application so I don't have to recreate the wheel, or hack something together as I go? ...

chrome safari javascript jquery back

Is there anything particular to chrome or safari that would make a javascript/jquery script work on the first page load, but then when the user hits the back button after navigating the site, it causes select boxes to be selected? Here is the code. Apologizes before hand for the lack of conventions. I had to get this up quick: http://w...

How to get my div to fade out with jQuery on page load?

I'm brand new to jQuery (and javascript in general). I've been meaning to use it/learn it for some time, and nows the time. So I'm going to use jQuery on this page to fade out the "under construction" warning at the top of the page on load. But I'm unfamiliar with any of the functions or selectors to use. I found this basic article at ...

jQuery extract id and then attach calendar based on class

I'm working with an existing javascript library that does an AJAX call and then executes an optional callback function. The callback function gets passed the HTML string that is being loaded into the DOM. I need to assign the jQuery datepicker to all elements in that HTML string that are of calendar class. A simplified example of the HT...

rendering multiline Javascript by using JSONP in rails

Hello, In a controller I try to render a javascript google ad to print it into some HTML using JSONP, like this <script type="text/javascript"><!-- google_ad_client = "pub-23222424"; google_alternate_color = "FFFFFF"; google_ad_width = 468; google_ad_height = 60; //--></script> <script type="text/javascript" src="http://pagead2.googl...

xmlhttpRequest error on google chrome

I have a method in javascript that does the folowing: var X = new XMLHttpRequest(); X.open('GET',U,false); X.setRequestHeader('Content-Type','text/html'); X.send(''); where U = path to a file...example: xyz/abc.txt. It works fine on firefox, but opening it on chrome gives me the following error: Uncaught Error: NETWOR...

Need help with $.ajax function - How to send an associative array ?

I would like to send data using $.ajax like this: $.ajax({'url': 'my.php', 'type': 'POST', 'data': arr, 'success': function(response) { alert(response); } }); The problem is that arr is an associative array that looks like: arr['description_0'] = 'very nice picture!'; a...

jquery ajax based registration form

Hi I must now seek help after too many hours of failure. I'm using a basic registration form with Ajax, but the form is not connecting to the database. I'm obviously overlooking something. So here's the field i want to validate. obviously, its the username. Username:<input type="text" name="user" id="user" maxlength="30"> <span id="...

Creating a CSS class in jQuery

I believe the .addClass() function in jQuery attaches a CSS class to the current selection, but I was wondering I could create or define a CSS class in jQuery, and then attach it? ...

slideshow working in firefox but not internet explorer

Any one help please the page is: http://weblink.computersforpeople.info/users/1/properties/518/images/2869 why it doesn't work in Internet Explorer, but ok for other browser. Many thanks ...

submit button disabled cancels form submit

I have a form like this: <form action="lol.php" method="POST"> <input type="text" name="fe" /> <input type="submit" id="submitbtn" value="submit" onclick="this.disabled = true;" /> </form> and in firefox it works perfectly, but in Internet Explorer (latest version) the button goes disabled but the form does not submit. I have also tri...

Help please. make the manual slideshow repeatable?

Any one help please the webpage is: http://weblink.computersforpeople.info/users/1/properties/518/images/2869 How can I make it repeatable, I mean when I click the next button on the last photo, it can go to the first one again. have asked before, but still couldn't solve. could someone help please. Many thanks!!! ...

Creating a cookie using PHP but having difficulty reading from javascript

I have set my cookie in PHP using the following: setcookie("id", 100, time()+100000, "/AP", "www.mydomain.com", 0, true); When I look at the cookies stored in the browser it looks like this: Name: id Content: 100 Domain: .www.mydomain.com Path: /AP Notice the . in the Domain When I set a cookie in javascript I get the same ...

Converting adblock detecting javascript to jQuery

I got this ad blocking code from http://adblockdetector.com/ (function () { var _ab = false; var _af = undefined; var _am = undefined; function detect_ab() { _af = document.createElement("IFRAME"); _am = document.createElement("IMG"); _af.id = '_afd'; _af.src = '/adimages/'; _af.style.display = 'block'; _af.styl...

Jquery continuous ajax request

Let's say initially I have an image loaded in my view. Every now and then, I want that image to change via ajax with an interval of 10 sec. How can I do that? Thanks. ...

jquery dialog become not appear

i have one jquery dialog which can show after click radiobutton. last time it can show but after i put some script for submit from dialog, the dialog become not show after click the radiobutton.this is my code: <script type="text/javascript"> $(document).ready(function() { $('#dialog').dialog({ autoOpen: false ...

Hide content after 3 paragraphs <p>

Hi all, Working with an API that spits out the contents in p tags ... but it gets too long. Thinking of hiding them upon reaching a limit of 400 characters, but that's not a good idea since there is a possibility of it cutting through a HTML tag. So I'm trying to hide the rest of the content after 3 paragraphs instead and with a text ...

Creating a connection between multiple browsers entirely client-side

I recently wrote a small AJAX-based chat program. The clients ping the server occasionally for new messages and update the view if a change has occurred. Simple. Is it possible to do this entirely client-side? Could a set of loaded pages identify themselves to other users and send out updates to the other clients? How would this be acco...