javascript

javascript - detect end of chained functions?

Today I'm working on a pet project using chained function calls, and I'm curious how I might detect when the last function in the chain is executed. For example: func1('initial data').func2().func3().func4(); And after func2-4 have finished working on 'initial data' I'd like to detect when func4 is done. Since func4() isn't always the...

Accessing object's member in a method in javascript.

Hi there! Why if i try: Object(n) //Constructor { this.member = n; } Object.prototype.alertX = function()// Method { alert(this.member); } foo = new Object(4); Object.alertX; I get "this. member is not defined". How can i access the constructor's member inside one of its methods? EDITED: my original purpose is to have an interna...

dynamic script tag loading is not working as expected

We have an application that uses both the google closure and dojo libraries. We have the following in our index page which works as expected: <script type="text/javascript" src="runtime/src/lib/google-closure-rev26/closure/goog/base.js"></script> <script type="text/javascript" src="runtime/src/lib/dojo_release_132_src/dojo/dojo.js"></s...

Dynamically add input boxes into form?

What I am trying to do is very similar to this question: http://stackoverflow.com/questions/1894009/using-jquery-to-dynamically-add-form-fields-or-fieldsets-based-on-a-dropdown-bo Specifically, I want to use a drop down box value to add that number of input boxes to a fieldset. I do not know jQuery so the answer I am linking to hasn't ...

Report the time spent on a page to the server.

Is it possible to report the time spend on a page back to server when the visitor leaves the page by closing the tab or the browser? Using Javascript. And it will work on Firefox, Google Chrome, Safari, Opera, and IE8 (IE7 and 6 are not important). But it will work in any case; even while the browser is closing, or it is typed another ...

How to hide/show table rows using jQuery?

I have a Zend Framework (PHP) web application that has a table with a lot of rows. 99.9% of the time, the user will take action on the first or second row. 00.1% of the time, the user will need to go back and take action on a different row. So I only really need to display the first few rows on page load, and keep the rest available ...

How to update a web page without reloading the web page using AJAX?

I'm trying to update info that a users entered in to a mysql database using php without reloading the web page how can I do this an example or tutorials will be nice. If there is a tutorial on how to do this can you please share with me the link or links to the tutorial(s). ...

style a form (select) using javascript, no framework?

anyone know how i can style a form element with javascript, but without a framework? Found a nice plugin for jquery but I don't use jquery at all on my website so I want to avoid it if possible.. I want to create a select box that looks like this: http://iforce.co.nz/i/qebncmoz.png to clarify, i want to set an image/background on the...

how to collaborate between javascript and php

i am calling a javascript for image gallery and php on a single page. let me show you some code to make things clear: PHP echo "<form method = post action = 'user_submit.php'>"; // get possible answers using question ID $query = "SELECT aid, atitle FROM answers WHERE qid = '$qid' ORDER BY aid ASC"; $result = mysql_query($query) or di...

RJS or Javascript?

I've used RJS in the past for RoR projects and felt terribly constrained by what it could do. However, using Javascript alone felt/feels ugly and hack-y. This is particularly true when writing Javascript that manipulates Rails automagically generated from variable names. I haven't seen much talk about RJS in the blogosphere recently. Is ...

[jQuery] $.ajax doesn't seem to be working

I'm working on a jQuery-powered registration form, and I'm checking all the input with jQuery, and the only thing left is to see if a user is choosing an already-registered name. Here's my Ajax request: $.ajax({ type: "POST", url: "check_user.php", data: "username="+username, success: function(){ errors.push('Your userna...

JavaScript repeat action when mouse held down

Hi, Is there to have a JavaScript function repeated every so many milliseconds that an html button is held down? It would be great if this could be done with standard JavaScript, but using jQuery or a jQuery plugin would be great too. ...

Unable to Display Model Dialog with JQuery-UI

I'm attempting to display a modal dialog as a test run before I try to perform a more difficult task. However, I seem to be doing something wrong as the code I copied from the demo site is not working when I set it up and run it locally. Here is my source: <html> <head> <script type="text/javascript" src="lib/jquery/js/jquery...

calling jquery facbox from button click

i am using facebox that give help for opening box from link but i want to open box from jquery click function not from hyper link. like $("#Button2").click(function() { code to open facebox }); thanks ...

MVC architecture for front-end

Hi! I am writing application in PHP (+ MySQL database), but it gonna be mainly AJAX aplication. So, I am wondering, how to create frontend? Frontend also in MVC? Is it possible? ...

javascript - arguments.callee.toString() and arguments.callee.name does not return function name

I'm trying to get the name of the currently running function. From what I've read, this should be possible using: (arguments.callee.toString()).match(/function\s+(\[^\s\(]+)/) However, when I run this in Firefox and Safari (latest versions on Mac) the name is not returned. console.log( arguments.callee ) returns the source of the fun...

How do i get html produced by javascript?

Hello everyone! I know the title is not very clear so i'll make an example: There are site A and site B, let's say they are financial sites. I need just one page (the one regarding italian pizza quotations) from both the sites, to compare some values and to know where and when to sell italian pizza at higher prices. Everything is really...

pyfacebook and javascript query

Hi, I'm using pyfacebook on the backend and javascript on the client side. Now if I want to pass a variable to the javascript from pyfacebook. how would I go about doing that, any ideas? ...

Directed graph layout engines on .NET / Silverlight / JavaScript / Flash

Hi! Who knows good graph layout engines with clear customization and managment? Flare is an cool one but it is written on Flex (may be you know how it can be customized without re-compilation and writing code?). I also know about JavaScript InfoVis Toolkit but it not good enough. ...

Very basic question about Javascript code execution

Do the code (e.g. functions) execute at the same time? or it follows the order in which it was written? (top to bottom)? I know that order doesn't matter in CSS and it matters in HTML, what about JavaScript? For instance, if a function it's executed then the next one (bottom one) will execute, or if 2 functions doesn't have anything to d...