javascript

Javascript difference between functions within an object

What is the difference between functions within an object. I have 2 examples which basically do the same thing. function a(param) { function b(input) { return input%10; }; return 'The result is ' + b(param); }; and function a(param) { this.b=function(input) { return input%10; }; return 'The result is ' + this....

How to use java.util.Observable from Javascript?

I'm building a Drupal module that integrates the "FileCatalyst" Java FTP applet with a standard Drupal form. I'm implementing a hook to submit the form when a file transfer completes. Currently I'm polling the applet with a setTimeout() call, but this method can miss changes of state if they happen too fast. However, the FileCatalyst ob...

SimpleModal confirm before closing dialog

I'm using SimpleModal (http://www.ericmmartin.com/projects/simplemodal/) and I have a form that displays in a dialog. What I want to do is be able to have a confirmation come up each time that the user tries to close the dialog (either by escape or clicking on the close icon) and asks them if they really want to close it without saving t...

Javascript can't change text in textarea once CKeditor instance as been called on it.

Hi guys. Well i first wrote a Javascrip function that would change the text in a textarea according to the selection you made in a dropdown box, a really simple thing. HTML <form name="formconteudo"> <select name="selectpage" onChange="change();"> <option value="1">something</option> <option value="2">another thing</option> <option va...

Can't set parent hidden input from iframe!

I have an iframe on my main page, and this iframe uses php code mostly (src is php file). At the bottom of this iframe I have this: window.parent.document.getElementById("qry_str").value='hey'; And in the main (parent) file, I have this hidden input which I am trying to set from the iframe with js: <input type="hidden" i...

"Back to search results" problem

I have a form with many inputs, but not all inputs must be filled in. Form action is set to a php file, which checks which inputs are set and builds a query to query MySQL. Then I display the results on the main page, and the users may click on an ad to show. When clicked an ad, a new page opens with several options for the user (chang...

can entire web document be cached/archived (including the precise state of the DOM) and later reloaded?

imagine that we have loaded a complex website with lots of Javascript which loaded all sort of info via AJAX and by making computations based on user input. So, now suppose we want to archive it in such a way that we can reliably load it later on from file (maybe even without an internet connection) and study its behavior / debug it / et...

Website that recognizes user's location/IP & changes lang. based on that

Hello, title is pretty clear. My websites consists of both English-written and Spanish-written versions. You can go to the main site, which is in Spanish, by clicking http://www.chrishonn.com and to the translated version, which is in English, at http://en.chrishonn.com. At the index of each page there is a link (at the bottom) which al...

rapidly create webpage front end

Exposition: I'm familiar with C/C++/Scheme & OpenGL. I have this client/server program written in Clojure that serves as a todo-list/wiki/forum. The server is written in Clojure. The client is written in Clojure and uses SWT. Question: I want to rapidly create a web client version of this. What is the best way to do this? (I Don't use...

remove semicolon in string by javascript

Does anyone know how can I remove the semicolon (;) from the string by using JavaScript? For example: var str = '<div id="confirmMsg" style="margin-top: -5px;">' How can I remove the semicolon from str? ...

Google Maps API v3: Group markers?

I'm using Google Maps with API v3. I will add many markers, now got question, is there posibility to group markers? For example, by city? I'm using a small snippet to creating sidebar with markers buttons. Here's the code: /** * map */ var mapOpts = { mapOpts: new google.maps.LatLng(60.28527,24.84864), mapTypeId: google.maps.MapT...

How can I use jQuery's replaceWith() function to make a href link trigger a function?

This is what I've tried: html: <div id="container"> <p>a paragraph</p> </div> <button>replace with link</button> script: $(document).ready(function() { $("a.foo").click(function() { alert('hello world'); }); function foo() { alert('hello world'); } $("button").click(function () { ...

How to add more than 2 views to a view stack?

Hi, I have been having problems simply adding more than 2 views to the stack through the Dashcode GUI interface. I have seen how to do that programmatically, but is there a way to statically keep extra views within the stack? I am actually okay with using a different stack, but the problem there is that I have to add another browser ar...

How to fire off an AJAX request and redirect AFTER making the request?

Hello all, I am making use of JQuery to fire off an AJAX request. As soon as that PHP script is initiated I want to redirect my browser to a different page. But the AJAX request must have been fired off successfully, it doesn't matter what that scripts returns. Currently I do the following, but it redirects instantly whilst the script w...

Send a location hash through a referrer

Hi. I have a page where in Javascript I add to the location hash something like: location.hash = "initial_source=previous_referrer". Afterwards a window.location is done in order to redirect. However the receiver gets the referrer in his request without the hash (#) part. Is it possible to somehow modify the URL in the initial page...

InfoWindow doesn't want to close with Google Maps Api V3

hi, i can't close the info window of the marker i'm dragging, any idea ? Thanks for your help function mapClick(event) { createLocationMarker(event.latLng); } function createLocationMarker(location) { var clickedLocation = new google.maps.LatLng(location) var gMarker = new google.maps.Marker({position:location, map:gMa...

RJS returns plain javascript without JS tags

Here is code on view in FeesController "show" action template: <div id="payers_controls"> <%= link_to_remote('New payer', :update => "payers_controls", :url => new_payer_url) %> </div> Here is new.rjs - belongs to PayersController "new" action page.replace_...

Endless Scrolling in Tumblr Tumblelogs?

I want to put endless scrolling (either the load more posts button or the scrolled to the bottom of the page type) onto my tumblelog. There's a theme that does this but I don't know how it does it. Any help is appreciated. ...

How to pass variable into jquery animate function properties?

function SlideObject(Side) { $("#div").animate({ margin+Side: "-1000px", opacity: "hide" }, 1000); } I would like to pass the value for "Side" into the name of property identifier (margin) for the animate function. I am aware that "margin+Side" is not valid it is just there as a place holder. For example if I ...

Applying Events Handler to Child Elements (Event Propogation in jQuery)

Hi Everyone, Edit : Problem wasn't related Event Propagation, if you want to know how to stop propagation in jQuery, then use event.stopPropagation(); When user moves his/her mouse over <span> element my jQuery code appends an <img>into this <span> element and when he moves out his mouse off <span> than the element appended is removed....