javascript

Comet VS Ajax polling

I need to create a chat like facebook chat. With Comet I need more memory to keep the connection. With Ajax polling there is a latency problem if I send request every 3-4 seconds. So... If the latency ( 3-4 seconds ) doesn't matter, Is Ajax Polling better for my case ? ...

javascript += help please

At my wits end here , any help appreciated In my json javascript live pull I have html += "<tr><td width=60 valign=top><a href='"+item.url+"' target='_blank'>"+item.site+"</a></td>"; The += seems to strip out my tr td values So I tried amending it to = which just seems to fail.. I tried setting td as a var and still no luck Any...

Escaping quotes in jquery

I'm having a bit of a problem escaping quotes in the following example: var newId = "New Id number for this line"; $(id).html('<td><input type="text" id="my' + newId + '" onKeyUp="runFunction("#my' + newId + '");"></td>'); The issue is that when I look at the generated code the id does update to id="myNewId", but in the function call...

JQuery Ajax: Old content flicks in before showing the loaded content

Hi, have a problem with my ajax code. I have some links and a content area. When i click on a link, i hide the content area, load the new data and show the content area again. It works, but when showing the content area, you see the old content for a short time and then it flickers to the new content. Can i somehow let the loading scre...

Does this basic Google Maps V3 location demo work for you?

http://code.google.com/intl/fi-FI/apis/maps/documentation/javascript/examples/map-geolocation.html I get a grey page with latest Google Chrome (access to location allowed for this website), but no error messages. Ideas? ...

targeting the closest tag of a certain class rather than the first in prototype

I wrote a javascript function that uses the innerHtml of a named div (that occurs immediately after the script) for each row as output. the problem is, if I use $('divname'), it always finds the first instance, not the nearest. What's the simplest way in prototype to target the nearest "divname" div? eg (note, I'm using Grails, hence th...

ASP.NET TextBox TextChanged event not firing in custom EditorPart

This is a classic sort of question, I suppose, but it seems that most people are interested in having the textbox cause a postback. I'm not. I just want the event to fire when a postback occurs. I have created a webpart with a custom editorpart. The editorpart renders with a textbox and a button. Clicking the button causes a dialog t...

i have some text following the mouse, i need to change that to an i frame, how do i do this?

$(document).ready(function () { //create the div var div = $("<div></div>").css("position", "absolute").text("a short message").appendTo("body"); //attach the mousemove event $("body").bind('mousemove', function(evt) { div.css({ "left": evt.pageX + "px", "top": evt.pageY + "px" }); }); }); what im trying to ...

Javascript src starts with //?

Possible Duplicate: Is it valid to replace with // in a <script src=>? I'm starting to see more and more script references show up like so: <script type="text/javascript" src="//somedomain.com/somescript.js"></script> Note the lack of http: at the beginning of the src attribute. It seems to work fine and avoids the messy ...

javascript function won't stop looping - It's on a netsuite website

I need to change the shipping carrier drop-down and shipping method radio button once via a javascript function, not forever. However, when I use this function, which executes when on the Review and Submit page when the order is < $5, it goes into an endless loop: function setFreeSampShipping(){ var options = document.forms['checkout'...

dropdown menu in IE7,8 needs fixin'

I've had lots of success in getting IE to play nice in the past, but I'm buffaloed here. The dropdown menu is visible and works, but it's having some margin/padding issues and no matter what kind of conditional statement or hack I try to employ, it won't straighten out. Example page: www.erisdesigns.net HTML (links removed so that I c...

How to deal with conflicting function names in Javascript if functions are from external js libraries?

I feel daft asking such a question here but I couldn't find any solution to it. I have two external js lib files I have to load on same jsp page. They both have a function called "autoSave()" both without parameters. I cannot modify their signature as they are not my script files. How can I call function in script A or script B expli...

Images wont show after I've cleared the content

Hey everyone, I'm a newbie using jquery and js either, so maybe thats the reason why i just cant undesrand why my code isn't working. I created this function createList to push image content into div element. (this part works great) So what i want to do is, creating an element witch holds every picture and after i have deleted the cont...

Does IBM use Dojo Toolkit?

I was told IBM no-longer uses Dojo. Is this true? A small amount of web searching shows IBM is/was a member of the Dojo Foundation and is/was a code contributor... If it is true, approximately when did IBM stop using Dojo? If its not, to what extend is IBM still actively using and promoting the toolkit (use in their public web sites, pro...

Mongodb MapReduce to concatenate strings?

All of the MongoDB MapReduce examples I have seen have dealt with counting/adding numbers. I need to combine strings, and it looks like MapReduce is the best tool for the job. I have a large MongoDB collection in this format: {name: userone, type: typeone} {name: usertwo, type: typetwo} {name: userthree, type: typeone} Each name only ...

How to get this.grandparent() functionality in Mootools?

I have built a class in Mootools and extended it twice, such that there is a grandparent, parent, and child relationship: var SomeClass1 = new Class({ initialize: function() { // Code }, doSomething: function() { // Code } }); var SomeClass2 = new Class({ Extends: SomeClass1, initialize: function() { this.parent...

Referencing and calling a method in JavaScript

I have some JavaScript/jQuery code that watches for the "changed" event on a checkbox: $(control).change(function() { alert("changed to: " + $(this).is(":checked")); }); This works fine. I'd like to create a reference to the change() function on the particular object, and call it indirectly, like so: var onSomeChange = $(control...

Can someone explain what the syntax means when defining a jQuery plugin?

Hi There, I am reading up on creating custom jQuery plugins and am a little confused as to the meaning of the following syntax: (function($){ $.fn.truncate = function() { return this.each(function() { }); }; })(jQuery); I understand that function($) is an anonymous function that accepts the $. I just don'...

IE New Element with Style?

Hi, I have this stylesheet: .pixel{ position: absolute; height: 10px; width: 10px; background-color: #ffcc00; font-size: 0px; } And this javascript: function drawpixel(x,y){ el = document.createElement('div'); el.setAttribute('class','pixel'); el.style.left = x; el.style.top = y; /* IE needs...

MooTools accordion won't collapse nested float in chrome&ie

While firefox manages, ie and chrome refuse to collapse the div any further than the height of the picture. Additionally (but minor), ie (properly?) wraps the text around the picture, while firefox for some reason i can't figure out has the text seem to float right. Thanks for any help! The javascript: window.addEvent('domready', func...