javascript

how to create an analytics tool?

hi! what should i learn in order to develop a (good and realtime) analytics tool? i think i should learn a lot of javascript, but i need some guidance... and i think i should also learn php... could you help me? which languages are better to capture, process and display analytics data (such as ip adress, country, date, time, os, brows...

How do I pass 2 parameters to Nant script?

Hello.. I have to write an Nant script that will accept 2 parameters on the command line. The first is just an option and has the following format: -myOption. The second one needs to be wrapped in quotes: "some value with space". e.g. -myOption "this value" I am new to Nant so I have unsuccessful so far and don't know how to output t...

Implementing placeholder="" for opera through jquery

I have implemented through jQuery the placeholder HTML 5 attribute for the browsers that don't support it (all except webkit at this time). It works really great but it has a small problem: it breaks the HTML 5 required="required" and pattern="pattern" attributes on Opera (it's the only browser that supports them currently). This is be...

Activesupport::JSON.decode crashes on this,

I wonder why i cant decode this json string, all what i want is to convert this to a proper Ruby hash, anyone have an idea? i think the array of objects is cracking it ? Parameters: {"{\"origins\":"=>{"{\"origin\":\"this\"},{\"origin\":\"dont\"},{\"origin\":\"dont me please\"},{\"origin\":\"and me please\"},{\"origin\":\"dont\"},{\...

Executing bookmarklet code when a page finishes loading

I'm trying to set up a bookmarklet that will go to a web page, enter in some login information, and then automatically click the Login button for me. My problem is that if I simply go to the page and then enter the login information sequentially, the script usually finishes executing before the form elements are loaded. So, I need some...

Getting the alt attribute of an image in prototype.

Hi, I'm editing some old sideshow code someone else written a while ago and I was wondering how you get the alt attribute of an image with prototype. Ive got the image tag selected with the code below: $$('#' + this.slides[this.currentSlide].id + ' a img') But for the life of me I don't know how to get the alt text. I've tried... $...

Convert IE event.button to W3C event.button

Hello, On mouse-down (and up) I need to check which mouse button has changed its state. This is pretty easy with the W3C model and even the old netscape way (event.which) but IE gives me a headache. I know that event.button in IE is a bitmask but the problem is that I can't find out which button was pressed from this bitmask. If IE give...

Javascript outer scope variable access

OperationSelector = function(selectElement) { this.selectElement = selectElement; } OperationSelector.prototype.populateSelectWithData = function(xmlData) { $(xmlData).find('operation').each(function() { var operation = $(this); selectElement.append('<option>' + operation.attr("title") + '</option>'); ...

How to pull data and export to excel within an ajax framework.

Hi, I have a very specific problem and i'm looking for input on a good way to approach it. edit:(simplified question) Essentially I have been working on a remote monitoring system for retail kiosks. I am operating within a framework that is entirely dependent on AJAX. I have been using XML to pass data between the clientside/serve...

Javascript/Jquery: using a variable in the css-property of animate

Hi! Why does this work: <something>.stop().animate( { 'top' : 10 }, 10 ); but this doesn't: var thetop = 'top'; <something>.stop().animate( { thetop : 10 }, 10 ); To make it even clearer: At the moment I'm not able to pass a css-property to the animate function as variable. Thank you! ...

Is it possible to disable right click on an iframe?

Is it possible to disable right click on an iframe? I know it might be possible if the file in the iframe resides in the same domain,but i was wondering if it could be done if the file in the frame was from an external site? thanks ...

Is it possible to test whether a user's browser/OS supports a given type of link using javascript?

Is it possible to test whether a user's OS/browser supports a given url scheme using javascript (or anything else)? For example, mailto: isn't setup on most user's computer that only use webmail. Would it be possible to somehow catch attempts to click a mailto link and pop up a more descriptive explanation than the browser error messag...

How can I give users a javascript widget to pull content securely from my site

I need to be allow content from our site to be embeded in other users web sites. The conent will be chargeable so I need to keep it secure but one of the requirements is that the subscribing web site only needs to drop some javascript into their page. It looks like the only way to secure our content is to check the url of the page hosti...

How can I get horizontal scrollbars at top and bottom of a div?

Since I'm pretty sure there is no native html or css way of doing this, I'm open to doing this with JavaScript. Obviously, I can get a scrollbar at the bottom of my div using overflow: auto in CSS. Is there some javascript that could "clone" the scrollbar from the bottom and place it at the top of the div? Maybe there's another way? ...

`new function()` with lower case "f" in JavaScript

My colleague has been using "new function()" with a lower case "f" to define new objects in JavaScript. It seems to work well in all major browsers and it also seems to be fairly effective at hiding private variables. Here's an example: var someObj = new function () { var inner = 'some value'; this.foo = 'blah'; ...

JavaScript how to mock confirm method

I have following code in my JavaScript code. if (window.confirm('Are you sure?')) { AdminData.actOnResult('delete'); } I am writing test for this piece of code. How do I mock window.confirm method? I tried following code but it did not work. window.confirm = function(arg) { return true; }; I can move the window.confirm meth...

Send complex sets of data to php from javascript without ajax

How can javascript pass data, for example from an HTML table, without using AJAX? I am lacking the understanding of how to actually pull data, format (into json likely), and pass it. I am trying to pass data to a php function that sends a file to the user to download. (something ajax can't handle as I understand it) EDIT - please give...

Internet explorer only executing function inside jQuery ajax success response once even though there are three requests

Hi, I have a function that uses jQuery.load() to call in 3 snippets of forms from different pages and then on the success text status it tries to load a colour picker: $(document).ready(function() { function ajax_form(putloadingboxhere, putsnippethere, snippeturl) { $(putsnippethere).load(snippeturl, function (responseTex...

javascript horizontal center

Hello, Im trying to use java script to center a page horizontally. So far i got this: <body onload="scrollBy((document.body['scrollWidth'] - 0) / 2, 0)"> It kinda works, but not very good. I have a large width flash component that I need centered when the page loads and also after any click on the internal buttons. I was thinking of...

Javascript navigation help

Hi All, I am working on a small script where there are some list items. If you refer to the below code you will notice that there are 15 list items. Now I just want to display 9 of them say the user log's in the 1st time the first nine should be displayed now if he clicks on list no. 7 then list no 3, 4, 5, 6, 7, 8, 9, 10, 11 should be ...