javascript

Getting the innerHTML of the next() Element on a Click Event using Prototype

I am attempting to get the innerHTML of the next element, next to which a Click has occured. So far, I have this as my code $('translate_this').observe('click', function(e) { // Immediately stop the click through Event.stop(e); x = this.next().innerHTML; alert(x); }); However, nothing actually happens,...

Form post using motools ajax and form check with motools form check.

Hi, I am using motools script for client side validation of web form. here is the link for that script http://mootools.floor.ch/en/demos/formcheck/ My problem is that when only form validation is used and form is subimitting with normal method is fine but when form validation is used and form is submitting using AJAX with motools. so...

creating google maps website - map city to latitude and longitude.

is there a way where i can enter a city name and get the latitude and longitude for that location as i am trying to take a list of cities and dynamically populate a google maps webpage. I have the idea of the code below but i dont have the Latitude or Longitude points. foreach (City city in cities) { marker...

Custom HTML Attributes,: Firefox vs. IE

What changes do I have to make to the following simple HTML page to get Firefox to read and set a custom attribute as it does in IE? <!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"&gt; <head> <meta content="text/html;...

How to request extended permission from a facbook fan page tab

I am trying to request permission to publish photos from a facebook fan page tab(iframe). I am calling Facebook.showPermissionDialog('publish_stream'); before the upload(which doesn't seem to do much) But I keep on getting this error when I try to upload a photo **caught exception 'FacebookRestClientException' with message 'Permission...

onclick submit one of two same form

I included one file (containing a form) two times in php file.I want to submit one form with onclick function. both forms are same. i wrote onclick function document.formname.submit(); I want to do somthing like this document.this.form.submit(); please give some solution. ...

How mapping of cities in a country-map is done? ( so users can search for ads nearby their cities )

I have a classifieds website. The users first have to specify their 'area of search'... I want to add a function where users also can check a checkbox to find ads 'close' to their selected 'area'. But I don't know how to 'mapp' or 'link' the areas together in a smart way. I need some advice on how to do this... For example, how is 'ra...

next instance of

hello! trying to get the next matching element in a list; var newScrollX = $('#projectImages li').next(".instOf"+myNo); the above works but i don't want it to go back to earlier instances in the list so; var newScrollX = $('#projectImages li').next(".instOf"+myNo+":gt("+cIm+")"); but that doesn't work. Any ideas? list is like th...

Can I detect the source of a focus? (Javascript, jQuery)

Hi all, Quick question - is it possible to detect whether a focus has come from a mouse click or a tab from a focus event? I guess if there isn't, I'll have to use a click handle on the same element to determine the source, but I'd prefer a way from the focus event. Thanks Gausie ...

Text scrolling javascript problem in firefox

Text Scrolling doesn't work in firefox (In IE it does). Markup + javascript: <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"&gt; <html lang="en"> <head> <script type="text/javascript" language="javascript"> var scrollspeed = "1"; var speedjump = "30"; ...

why is parent node for input element undefined?

I have a table in which I am adding some rows dynamically and in the new rows, I add one input text element. When the text in the input element changes, I wish to access the parent row and do something around it. But my code isn't able to access the parent node for input element. Following is the code sample. What is the reason for this?...

How can I validate a SOAP Request

Hey y'all.. Is there a a quick way to validate SOAP messages? I have seen validator for JSON objects. Is there something like this for SOAP? I am recieveing a 'Bad Request: 400' error response with a AJAX post I am working on. I am not too familiar with SOAP as I typically just pass JSON. Can someone tell me what is wrong with my reques...

How do you prevent ONE radio button in a group from being selected, but allow others to deselect it?

Hi there, We have a form with a radio button group, where any one of the buttons may already be selected. We want to prevent a user from selecting one of the radio buttons, BUT we want to be able to 'deselect' that radio button by clicking on any other radio. Like so: Step 1: (initial page load) R1: enabled and clickable R2: disabled...

Can I construct a JavaScript object without using the new keyword?

Here is what I'd like to do: function a() { // ... } function b() { // Some magic, return a new object. } var c = b(); c instanceof b // -> true c instanceof a // -> true b instanceof a // -> true Is it possible? I can make b be an instance of a easily by hooking a into its prototype chain but then I have to do new b(), which is...

Javascript operator !==

What is the difference between the !== operator and the != operator. Does it behave similar to the === operator where it compares both value and the type? ...

Selector - Selecting all tables on a page in jQuery

Say I have multiple tables (no IDs or names) on a page at various levels within embedded divs. What would my selector be (if it is possible) to select all tables regardless of where it resides on a page and iterate or filter the tables based on the content of the first cell in the first row? ...

jquery newbie: how to efficiently do multiple actions on same DOM element?

Hi everyone, I recently learned (here on stackoverflow : ) ) that when using jquery every time I write $("...") a DOM search is performed to locate matching elements. My question is very simple: how do I efficiently perform a series of actions (using the nice methods of jquery objects) on a DOM element I have located with jquery? Cur...

Get size of mouse cursor in javascript

Hi, I need to determine the width and height of the current mouse cursor used on our webpage. I need to show a div right under the cursor, and possibly to the right of it. So I need to determine the offsets of my div from the exact pointer location, so the cursor do not cover up the div. The mechanism will be used in intranet system...

for each ... break

I feel dirty every time I "break" out of a for-each construct (PHP/Javascript) So something like this: // Javascript example for (object in objectList) { if (object.test == true) { //do some process on object break; } } For large objectLists I would go through the hassle building a more elegant solution. But ...

JavaScript Object Literal Notation Internal Variable Pointing

I have an array of variables. And I want one variable to equal the previous one. For example: var myVars = { var1: "test", var2: var1 }; alert(myVars.var2); //output: var1 is not defined Any thoughts? I'm sure this is some sort of variable scope limitation. I would like to hear otherwise. Thanks in advance. ...