javascript

Generating async Javascript events from browser plugin (NPAPI)

Hi! I'm writing a web browser plugin (NPAPI.) My plugin starts a worker thread, and as the worker progresses, I'd like to pass events back to Javascript. But because of the NPAPI threading model, it's not legal for the worker thread to call back into NPAPI directly, so the worker thread can't invoke Javascript. One solution to this is ...

Javascript Exception Handling with email notification for Django

I very like the standard way of server side (python) exception handling in Django. And I want to have the same mechanism of client side (javascript) handling of exceptions. Now I found only DamnIT. But this server is returning 502 error now, and I don't like so much the way to use external service for simple sending emails with exceptio...

What is the problems of using onClick function in Javascript?

Is there a particular reason programmers prefer not to use onClick function in Javascript? ...

How does yui improve performance?

Hi Guys, Just curious to know if yui improves performance? As all the css and javascript files are on the YAHOO servers and only a part of it is loaded when needed. so does it help in improving performance? Thanks ...

Javascript html injection

I have to inject the following line of html to a document through javascript: <button type='button'>btnName </button> In addition to this, I have to register an onclick to the button where the function to be invoked expects an arg say 'arg' so the javascript looks something like this: var html = "<button type='button' onclick='+ fnNa...

how to focus a tr or td tag using jquery or java script?

for(var i=0;i<tr.length;i++){ var td = tr[i].getElementsByTagName("td"); if(td[2].innerHTML==time && td[3].innerHTML==cls){ td[0].setAttribute("id","focus"); tr[i].style.backgroundColor="green"; var foc = document.getElementById("focus"); foc.focus(); cnt++; } else{ tr[i].style.backgroundColo...

Jquery: Appending data to a div AFTER ajax load operation

Hi I have a setup much like this: $('.container a').click(function(event) { event.preventDefault(); $('#contents').remove(); $(this).parent().append("<div id=\"contents\"></div>"); $('#contents').html('<img src="/images/loading.gif" />') .load("stuff.html") .append("<div id=\"closebut...

populating select box from controller function in Rails

I have a Rails web application with a select box: <%= select_tag :foo %> I'm looking to write a function in the controller which would populate this select box with some values. What code would I need to write in order to do that? The function is being invoked using observe_field: <%= observe_field :foo, :url => { :action => :popula...

XMLHTTP.open Not working in secong Call in IE6 and Running Properly in firefox

HI i have flowing code that runs as expected in Firefox and in IE6 it runs proper at first time and when the second call made it makes problem and returns old value function loadCartItems() { var xmlhttp23; if(xmlhttp23!= 'undefined') { xmlhttp23=getXmlHttpObject(); } xmlhttp23.onreadystatechange=function() { if(xmlhttp23.readyState...

Regular expression to replace string?

Hi, I'm trying to work out what regular expression I would need to take a value and replace spaces with a dash (in Javascript)? So say if I had North America, it would return me North-America ? Can I do something like var foo = bar.replace(' ', '-') ? Thanks ...

Style to remove all styles

Is there any way to apply a style that will effectively block the application of any applied or inherited styles for that object and any contained objects? ...

How to import email contacts from various email service providers in a website?

Hi, I am trying to implement a email invitation tool that can be used by a member in my website and invite his contacts over email to review blogs. But I am not able to find a way to design the tool for multiple email service providers so that I can reach out to a maximum crowd. I have experimented with Google Contacts API in JavaScript...

Digital Stop Watch

Hii, I have an input time in millisecounds. I want to include a digital stop watch in my application.i.e The time will dynamically change like a digital clock in every seconds. ...

delcare a function?

i wonder what the difference is between these two declarations: var delay = (function() { var timer = 0; return function(callback, ms) { clearTimeout (timer); timer = setTimeout(callback, ms); }; })(); function delay { var timer = 0; return function(callback, ms) { clearTimeout (timer); ...

Positioning a Tooltip

Hello guys, I'm trying to make my tooltips pop up in the left side of the cursor instead of the right side, with a jquery plugin called EasyTooltip. I'm trying to give a negative value in the header's call, which aim would be to affect the x-axis positioning, but with no effects (nothing appears, while a positive value in both axis shal...

What is the best practice for writing bookmarklets

I am writing some bookmarklets for a project that I am currently working on and I was wondering what the best practice for writing a bookmarklet was. I did some looking around and this is what I came up with javascript:void((function() { var%20e=document.createElement('script'); e.setAttribute('type','text/javascript'); e...

Confusing operation of JavaScript `var` keyword

I’ve run into a very strange (to me) problem with the var keyword. I’ve reduced it to a fairly minimal test case, and found it’s exhibited in Node.js (thus, V8 and Chrome), Safari 4’s inspector (thus, Nitro), and FireBug (obviously, SpiderMonkey). I was originally preparing a bug report, but since it’s so widely displayed, I’m going to a...

Where is the dialogs' source code in CKEditor?

Could somebody with experience in CKEditor give me some pointers where to edit the structure and contents of the "insert Link" and other dialogs? At the moment, I want to modify the width of the link window, so that changing tabs doesn't result in the dialog being resized every time. I'm sifting through both the minified and unminified...

Writing numeric words with onkeypress

How can I write numeric numbers into an input field by pressing a button? Suppose I have a button <input type="button" value="1"> Then I want, that when numeric pad button 1 is pressed it ads numeric words just like Windows Calculator. ...

Adding event handler to iframe to invoke on keyup

On the webpage I have iframe, in which I display some content. I want to run a function if any key is pressed inside iframe (iframe is editable). I can do it using ajax (with scriptmanager on page): Sys.UI.DomEvent.addHandler(document.getElementById('iframe1').contentWindow.document, 'keyup', iframeKeyHandler); But I want to do it wi...