javascript

Is there a port of prefuse in javascript/flash?

http://prefuse.org/ It's originally written in java,but I want to do it with client script,like javascript/flash. ...

jquery, trigger, bind, strange parameter

Hello, I have the following code: <body> <form> <input type="text"/> </form> <script> $( function () { $(document).bind("EVENT", function (event, element) { console.log("BIND", element, event); }); $("form").each( function iterate(index, element) { ...

Setting a greeting based on user's time (Good morning, good afternoon…)

I'm sort of lost. Can anyone extrapolate on how to implement a basic "good evening" or "good morning" based on the user's time setting? Perhaps PHP will fetch the server time, but I'm looking to greet the site visitor with a time-based appropriate greeting that considers their time of day. E.G.: good morning, good night, good afterno...

MooTools: Element disposal

Let's say I have two elements on a page. One is a div, and the other is its child, an achor. Let's say that I've added an event to that anchor via anchor.addEvent('click', ...). If I set the div's .innerHTML = '', does the 'click' event associated with the anchor get removed/disposed of/garbage collected? ...

How to get CPU utilization using Javascript or Java

How can I get the CPU utilization of client's machine. I have created a Java web application and where I need to get the CPU utilization of client's machine. Can it be done using either Javascript or Java? ...

Remove first character from a string if it is a comma

Hi Guys, I need to setup a function to remove the first character of a string but only if it is a comma (, - Ive found the substr function but this will remove anything reagrdless of what it is. I thinking some regex might be involved and i had a look but i cannot work it out My current code is text.value = newvalue.substr(1); T...

Confused about JavaScript prototypal inheritance...

In the book "JavaScript the definitive guide 5 edition", section 9.2 Prototypes and Inheritance, I find the following words: In the previous section, I showed that the new operator creates a new, empty object and then invokes a constructor function as a method of that object. This is not the complete story, however. After c...

How to hide the parent vertical scrollbar after an iframe is loaded?

Hi, I have attached the sample code which demonstrates the problem. I am checking this in Firefox 3.5.7. The problem is the parent HTML has a scrollbar, and it loads an iframe which is fullscreen (height: 100%, width: 100%), I want the parent scrollbar to be removed after the iframe is loaded. 1) Is this possible to do? 2) When we giv...

KeyNotFound Exception when calling Html.ValidationSummary() dynamically through helper method

Hi, I have a Helper Method in my View which renders the whole form dynamically. Now i want to add a support for Client Validation as available in Asp.Net MVC RC 2. Following is the code i use to render Validation Summary field onto the Form. _viewPage.Html.EnableClientValidation(); MvcHtmlString validationSummary = _viewPage.H...

javascript tricks. Why (a,b,c) => 5

. var a,b,c = function() { return 5; }; Variables a and b is undefined, c is function, why when we do this (a,b,c)() we have 5 ? ...

Get HTTP headers with JavaScript

Can I evaluate the status of a URL on a remote server with JavaScript? Is it considered a cross-domain reference even if I don't get the actual contents of a document? If it's not possible through plain JavaScript, could I perhaps load the document in an iframe? What I would like to do is to check if the HTTP status code is 200 and if ...

Loading images on a web page using mootools when user scrolls page down

Does anyone know a library that would automatically load images as user scrolls down? The idea is that I want to add user avatars on a wall dynamically when viewport changes. The related HTML would be something like this: <div class="comment"> <a class="avatar" rel="nick" href="users/nick"></a> <p>comment goes here</p> </div> Wh...

how to find time taken to load a page

How to get the time taken to load the current page. Is that can we find how much CPU memory utilization for that page to load..? ...

How to test non-dojo javascript code with doh?

doh is the dojo unit-testing framework. I am trying to use doh to test a non-dojo javascript code, but i am facing the problem that doh seems intrusive and oblige me to use dojo.provide() in the tested js file(and the corresponding dojo.require() in the test js file). I want the tested js file to be unmodified and dojo-agnostic. Is it po...

Div in screen center when there are frames ?

How can I place a div into the SCREEN (not page) center, when the div is in an iframe, and the div's x position for being in the SCREEN center is too far left for still being on the iframe page (div.x < iFramePage.x) ? The iframe is in a table in the right row, and in the left row there is a navigation treeview. Now my div should ...

Prototype addMethods is returning "undefined"

I'm attempting to add a method to prototype's Element object called locateAncestor(), which will find and return the DOM node based on tagName. My code is as follows: Element.addMethods({ locateAncestor: function(element,tag) { element.ancestors().each(function(e) { if (tag == e.tagName) { alert(e.id); ...

Getting the text under the mouse pointer

I'm writing a browser add-on and want to get the word / words the user is currently hovering over via Javascript. ...

How to set the image src using jQuery

I am trying to change the image src attribute using jQuery jQuery("#imageID").attr('src','http://localhost:8080/images/1/myImage.png' ); using the above code i can change the src attribute, but when i try this:- jQuery("#imageID").attr('src',jQuery("#imageBlock").css('background-image') ); i am unable to change the src. provided...

Pass var through JQuery load

Hi, a very simple question I am sure just the brain isn't working this morning. I have the folowing code I am using with JQuery and the Google Maps v3 API. I basically am trying to refresh a map with new search results once it has been dragged to a new location. google.maps.event.addListener( map, 'dragend', function() { var ...

Check which JavaScript function is run after clicking button in Internet Explorer

Is there any way or tools I can check which JavaScript function is run after clicking a button in Internet Explorer? ...