javascript

How to get the Global Object in JavaScript?

I want to check in a script if a certain other module is already loaded. if (ModuleName) { // extend this module } But if ModuleName doesn't exist, that throws. If I knew what the Global Object was I could use that. if (window.ModuleName) { // extend this module } But since I want my module to work with both browsers and ...

JQuery Toggle only 1 item and the others not clicked

Ok so i have this Jquery that will toggle some radio buttons on the page. I want it so when someone clicks on one of the radio buttons the others are not clicked. Currently the way i have it they can select 3 at a time and I need it to act like a regular radio button that one is clicked and the others are not jQuery: $(function () { ...

How to check whether CKEditor has some text in it?

I have a HTML form with a few fields and one of them is textarea managed by CKEditor. When the user wants to submit the form, I want to check whether he entered values in all the fields. I know how I can check if CKEditor control has anything in it, but those could be "empty" HTML tags, without any text in it. How do I check for text? ...

Form inputs hash navigation and serialization using Prototype.

Given this object is SELECT input which name = "record[exp_items][1279485786799][batch]" and I want to find all fields in "record[exp_items][1279485786799]" artificial hash and serialize them. Keep in mind that 1279485786799, exp_items always change, so I need either move to one level up in hash and serialize it or find all these objec...

Simulate a click by using x,y coordinates? - Javascript

Hi folks, is it possible to use coordinates in order to simulate a click? Or is this technically impossible? :O I'm using Javascript within a webpage. Help would be great, and also quite interesting!!! =) ...

Catching any click performed using jQuery

Hi folks, the noob way to do it I guess would be $('*').click(function(){...}); But is there any way I can catch any type of click, without having to register a listener for every object in the DOM? Help would be amazing. =) ...

Any way I can interact with a jQuery animation queue? - jQuery

Hi folks, Any way I can interact with a jQuery animation queue? I would like to be able to use an animation as if it were a movie of some sort, enabling me to rewind, fast forward, or even play the animation from a certain relative time. I understand if this might be way too complicated to achieve, but for me it's worth asking and f...

Web application architecture design

I am starting a new project trying to create a web application for an electronic programme guide for TV. This is not going to be a large scale project, but just something that I can use to learn web application programming. I am going to be using PHP for this. Before beginning coding for the application, there is a crucial question that...

How to inherit a C++ class in JavaScript?

I am embedding SpiderMonkey to make my C++ library scriptable. To make it extendable, I need it possible to define a new class (JavaScript) inheriting one C++ base class of the library. Is there an example showing me how to do that using SpiderMonkey? ...

How to write a server-efficient ad network script?

I'm writing an ad script that loads advertisements to websites across the network. The ad script has to keep a detailed log and serve advertisements. At the very minimum, it should log the number of impressions for each advertiser and the number of impressions for the publishers. I'm thinking about building the backend on PHP and then h...

How do you access the parent window when you open a popup window to oauth with twitter using gwt?

I got oauth working fine with twitter in my GWT app. However, when I use Window.open() to try and do the oauth flow, get a successful oauth, and twitter redirects the newly opened window to my callback url, I have an issue. The only way I can see to close the window is to use JSNI and call $wnd.close(). After I close the window I am u...

How to convert Jquery.serialize() data to JSON object?

Is there any better solution to convert a form data that is already serialized by jQuery function serialize(), when the form contains multiple input Array fields. I want to be able to convert the form data in to a JSON object to recreate some other informative tables. So tell me a better way to get the serialize string converted as a JSO...

Weird problem with JSMock

Can someone explain what's going on here, and how to fix it? I'm using JSMock, and executing the following code in spec.js: for (var t in []) { alert(t) } ... causes my browser to alert "eachIndexForJsMock" (when it shouldn't execute the alert command at all). This is messing up my for each loops. How do I fix it? ...

a new approach to web development: request for tools and components recommendations

I'm searching for the best possibility to write web applications that are heavy with JavaScript . So I'd like to present you my ideas and ask for your opinions and alternatives on this, please :) 1 year ago I started looking for possibilities for web development besides PHP. I found JSP and Django. I decided to go with Django. After sta...

How to make a select field show list of options? - Javascript/jQuery

Hi folks, I'm trying to mimic focus on a select field. e.g. When a user gains focus on a select field, the select field shows the options in a drop down list. When using $('select').focus(), the options are not shown. Any help on this one guys? =) ...

jQuery/JavaScript validation controls

Hi, I have a form on a sharepoint site and want some fields to be required fields (datetime picker etc.). To make some other fields visible/hidden and also add a red * after required field titles I use (example) : //Strategic Priority $('nobr:contains("Strategic Priority")').closest('tr').show(); $('nobr:contains("Strategic Priority")'...

jQuery changing the location based on the html

Ok, so I have this ul listed below and the buy now link under it that currently goes to /two_hours. I want it to change the location based on what is clicked. For example if I click the 4 hour button i want the url to the buy now button to go to four_hours and so on. Here is my jQuery so far: $(function () { $('.box-ul .btn .dot').c...

How can I rotateY an element without dipping underneath the page in 3d space?

I'm attempting to achieve a CSS 3 effect where when you click on an image in a bank of images, it expands to all the available area and flips over at the same time. The way I was able to accomplish this was to clone the element and absolutely position it on top of the original then transform that. In the code below the cloned image is a...

Select a specific character in a string and offset it (visually) with Jquery

Hi I'm trying to use Jquery/Javascript to mimic a broken typewriter font (since I could not find one). But I want to make it random which letter gets broken. I was able to split the string of the id that I wanted and use a bit of code I found to get a random number between 0 and the total length of the string. What I'm having proble...

Is it possible to detect a visitor's browsing history using JavaScript or PHP?

I want to check if my site's visitors have visited another particular site before coming to mine. I know how to use JS and PHP to check to see (via referrer info) if the user has just come from that site to mine, but I would like to be able to detect if they have visited this site at any time before (not just immediately before coming t...