javascript

Would like to recup a string of a javascript function in a XUL code

Hi everyone, I'm trying to do a plugin for firefox in XUL language. So I got informations in json, I parsed them and I can use the title in javascript. But I would use it in XUL language. For exemple, in html you can write : <a href="javascript: function()"> link </a>; So I need to list each title in a menuitem label, but I don't want ...

select all text in contenteditable div when it focus/click

Hi, I've got contenteditable div as below. <div style=" border:solid 1px #D31444" contenteditable="true">12 some text...</div> What I need is, when I click on the div, all the text will automatically get selected. Can you give me solution please? ...

Rails Javascript compression/minification on respond_to javascript response?

Greetings Rails and Javascript Gurus! I have a project where I am returning a large javascript file in a respond_to do |format| format.js end block. I am trying to figure out how I can minify or compress the .js response since the .js.erb view is full of comments and varies in size based on the results from the controller. Anyo...

How do I grab several elements and wrap them in a div using jquery?

Hello, I am familiar with wrap() and innerWrap(), which grabs every div and individually wraps each instance of the div in a wrap() parameters. IE: <div class="wrap me"></div> <div class="wrap me"></div> <div class="wrap me"></div> Becomes <div class="wrapped"><div class="wrap me"></div></div> <div class="wrapped"><div class="wrap m...

Javascript animation of CSS classes?

Is it possible to animate the replacement of a class in javascript? Let's consider I have this: .class1 {background-color:blue;} .class2 {background-color:red;} Is there any Javascript library that can ease the change between the two classes? That wouldn't make the user's computer explode? If not, what would be a good way of ach...

Confused about AJAX XMLHttpRequest

The javascript is function loadXMLDoc() { xmlhttp=new XMLHttpRequest(); xmlhttp.onreadystatechange=function() { if (xmlhttp.readyState==4 && xmlhttp.status==200) { x=xmlhttp.responseXML.documentElement.getElementsByTagName("CALL"); txt=x + x.length; document.getElementById("myDiv").innerHTML=txt; } } ...

jQuery: Why would trigger not fire from a JS object?

I've been implementing a form of a publisher/subscriber design pattern in jQuery. I'm basically building classes in Javascript utilizing CoffeeScript that serve as components on my page. i.e. Navigation, DataList, etc. Instead of having DOM elements fire events, I have instances of these classes that use trigger on themselves to send cu...

How to call mouse over function on dyanamic divs.

i have dyanmic divs as rows <table border=1><tr><td> <div id='div1'>fgg</div> <div id='div2'>dfgdfg</div> <div id='div3'>vcbcvb</div> <div id='div4'>sdfsdf</div> </td></tr></table> How can i call jquery funtion on moueover of each div.? These divs are dyanmic, can vary the number . ...

How to implement an 'onVisible' event in Javascript?

Is there any technique or set of techniques that can be used to implement what, in effect, would be an onVisible 'event' in JavaScript? I would like my JavaScript to detect when an element in a web page, such as a paragraph of text, or an image, becomes visible in a browser window as a user scrolls down a page. I would also like a corre...

How to get the "absolute" position of an html element

Hi guys, I have some elements positioned via CSS this way: #myItem{ position: absolute; left: 50%; margin-left: -350px; } I'd like to get their distance from top and left margin of the page. How can I get those measure with javascript/jquery? Thanks ...

Synchronous GET request with Javascript/jQuery

I have a function that makes ajax GET request and based on the value returned sets one global JS variable. I use this variable (isCalculateTax in the code below) for further processing: var isCalculateTax; function setCalculateTaxValue(taxStatementId) { $.get('/taxstatements/calculatetax/' + taxStatementId, function (data) { isCalcu...

Is there a Javascript library to parse and pretty print .NET exceptions returned as JSON?

If I'm making a call to an ASMX web service and an exception occurs, the web service will return something like this: {"Message":"Guid should contain 32 digits with 4 dashes (xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx).","StackTrace":" at System.Guid.TryParseGuidWithNoStyle(String guidString, GuidResult& result)\r\n at System.Guid.TryPars...

Keep image location and correct flow around

Hello! My problem is: <div style="width: 400px" contenteditable="true"> abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc (...) abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc <img src="pic.jpg" style="display: block" /> abc abc abc abc abc abc abc abc abc abc abc abc abc abc abc (...) abc abc abc abc abc a...

Detect file changes in node.js via watchFile

I want to detect changes for a file, if the file changes, I will use child_process to execute a scp command to copy the file to a server.I looked up node.js documentation, the fs.watchFile function seems do what I want to do, but when I tried it, somehow it just doesn't work as I expected. The following code were used: var fs = require(...

Auto-resize IFrame

Hi All, I really need someone's help on this> I have a little image inside an IFrame that upon being clicked on, will display another image and slide down a little. How can I make the IFrame automatically get bigger or smaller, according to its contents? Thank you so much! *edit After researching this more, I have found quite a few ex...

Any significant reasons not to use AJAX?

I'm planning on making my web app quite AJAX heavy. Before I do, I'm wondering what people think of such sites. Are there any significant reasons not to do this? BTW, no need to mention SEO reasons. Also, I think the benefits make up for the fact that people without javascript will have a limited experience (though I'm open to being ...

Javascript not working IE 8 on Windows

Hi Everyone! I have 4 images that I use as a navigation menu, when I click on one it lights up (changes image) and the current goes out, and so on so forth. It works well in chrome and ff (no firebug errors) But in IE8 the functioning of the clicks (where it changes the view of a div) work it just doesn't change the img src here's the...

A javascript Object ambiguous problem

this is a very very strange problem... see this code: <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"&gt; <html xmlns="http://www.w3.org/1999/xhtml" lang="zh-CN"> <head> <title>TEST</title> <script src="http://misc.fandongxi.com/js/jquery.1.4.js" type="text/javasc...

disable scroll bar in IE

Can I disable vertical scroll bar in IE. ...

User Google Closure to lazy load javascript

I'm especially liking the ability to require other javascript classes by using Google Closure, but I'm wondering if it's possible to use goog.require to lazy load other javascript classes. When I trying using goog.require after the page has loaded, it seems to refresh or go blank :( Any way to get a script on demand, and maybe set it up ...