javascript

How to generate function call graphs for JavaScript?

Are there softwares that can generate graphs that show which functions call which functions? I need to analyze JavaScript source code, a language which Doxygen/Graphviz does not support, though it does support C++ and others. If there are no tools that support JavaScript out-of-the-box, is there a way to convert JS to C++ so I can use ...

Disable "Save Target As" option in the right click menu

How do I disable the "Save Target As" item in right click menu in Internet Explorer and Firefox browsers? ...

Thickbox problem - appearing at bottom of page

I have a PHP page, in Wordpress. When I add a inline Thickbox to the page and attempt to open it, the Thickbox opens at the very bottom of the page, after the footer. Strangely, I took the generated HTML code, and made an HTML file with it. That HTML file opens the Thickbox correctly. The only difference is that it is not being gener...

Javascript: Why use /*, */ around arguments and why use >>> when extracting the length of an array?

I was looking in the javascript reference manual on the indexOf page at developer.mozilla.org site, and noticed a few things in their implementation code of indexOf, I hope somebody can explain to me. To save everybody a round trip to the mozilla site, here is the entire function: if (!Array.prototype.indexOf) { Array.prototype.index...

How to convert a document back to string?

I need a java script function that converts the document object of the current loaded page back to it's source text. In firefox it's smth like that: var doc = document; var str = (new XMLSerializer()).serializeToString(doc); alert(str); But i need a cross browser solution. How would this be done? For example: <html> <body> <sc...

How to highlight div using javascript or jquery

Hi folks.. I spent about hour and did not find any clue how to highlight my div. Ok example my code. 1.proccess.php $_SESSION['msg']='<div class="success">Your account has been updated</div>'; header("location:http://domain.com/account.php/"); 2.account.php if ($_SESSION['msg']!="") { echo $_SESSION['msg']; unset($_SESSION['msg']);...

how to remove key+value from hash in javascript

Given var myHash = new Array(); myHash['key1'] = { Name: 'Object 1' }; myHash['key2'] = { Name: 'Object 2' }; myHash['key3'] = { Name: 'Object 3' }; how do I remove key2, and object 2 from the hash, that it ends up in a state as if i did: var myHash = new Array(); myHash['key1'] = { Name: 'Object 1' }; myHash['key3'] = { Name: 'Objec...

Any tools for optimizing javascript?

I'm in the process of writing a jQuery plugin, and am getting into some fairly heavy operations, which is making my plugin slower and less responsive. I was wondering if there was any tools out there that would help me optimize my JavaScript? ...

Count characters in P keeping non-latin characters

I have a script that counts the characters in each of my comments, excluding any Html Tags. But it doesn't take into account that my comments contain åäöÅÄÖ (swedish letters). So how do I edit this to "exclude" these from the regexp variable? (If the comment is "Hej då!" the result is 6, not 7.) Why I need this is a long story, the pro...

Add form element dynamically using javascript -- not submitting

Edit: I fixed the problem by just starting from scratch. Sorry to waste y'alls time. Please vote to close if you feel so inclined. I'm having trouble getting the actual data in a form to submit when the input fields are added via javascript. The fields show up, and in the right place, but when I do a var_dump( fieldname) on the serve...

JQuery: hiding/showing an element within an inactive tab

I've got 3 tabs. Each of them have a div called optional, apart from other elements. optional is initially hidden using Javascript, I dun wanna use CSS ( this is so if js is disabled, the div won't be hidden at all ). So I use this to hide optional $(function(){ $('#optional').hide(); }); Now, this works just fine on the first ta...

Remove all text in between a div without losing text outside of it - jQuery JS

I have some text that is stored in a variable like this: <div class="foo">text inside div</div> outside text here. I want to remove the entire div and the text in it and save the outside text. ...

Resource interpreted as other but transferred with MIME type text/javascript?

I keep getting "Resource interpreted as other but transferred with MIME type text/javascript.", but everything seems to be working fine. This only seems to be happening in Safari 4 on my Mac. I was advised to add "meta http-equiv="content-script-type" content="text/javascript" to the header, although that did nothing. ...

Can I get some help decoding this bit of a Facebook page?

Hi, I'm trying to figure out just how a particular function works on a Facebook page, and being no friend of JS syntax, am having trouble. Here's the question mark bit: <a href="#" clicktoshowdialog="my_dialog" onclick=" (new Image()).src = '/ajax/ct.php?app_id=4949752878&action_type=3&post_form_id=3b933f46f9c4c44981e51b90c754bfce&...

html, javascript - popup window

Hi guys, i have popup-window in my script. I use window.open, but almost all browsers block this kind of windows. So i wanna change it to another popup, which include php-script. I saw it at another sites. As i understand, they use ajax. Could you provide for me some more info? ...

Default Values for JSON in javascript

In the code: slider.init({ foo: "bar" }); var slider={ init:function(data){ } } If I use data.foo, I will get "bar". Supposing I have an optional variable called fish which can be included in the JSON variable. If I reference data.fish, I will be told that it is undefined or an error will be thrown or something. Is there a way th...

Convert times created by Javascript's getTime() method to ruby Time objects

Javascript's getTime() method returns the number of milliseconds since midnight of January 1, 1970. How do I convert the output of getTime() to a Ruby Time object? ...

Make scrollLeft, scrollTop changes not trigger scroll event

Hello world, Currently my program is in a spot where it both listens for the user to scroll a certain element, but also, at times, automatically scrolls this element by itself. (Not a gradual, pretty scroll, but an instant jump. It makes sense in context, I swear.) Is there a way to make the scroll event not trigger if the scrolling wa...

Escaping special characters in JavaScript

Hello all. I need a method in JavaScript to escape all characters which are not ( a-z / A-Z / 0-9 / - / _ ) If the character is ø it should be replaced with oe, if it's å then replaced with aa, and more.... if characters are not on the list, they should be replaced with an underscore. If there are 2 underscores in a row ( __ ) they sh...

Google Translate API - isReliable not returning anything

Has someone ever used isReliable with the Google Translate API? It always returns "undefined" value. google.language.translate('hello','','es',function(result){ alert(result.isReliable); // prints undefined alert(result.translation); // prints "hola" }); Resources: Google Translate API - Result objects ...