javascript

Php script to javascript

I am trying to write something similar in javascript function Spin($txt){ $test = preg_match_all("#\{(.*?)\}#", $txt, $out); if (!$test) return $txt; $toFind = Array(); $toReplace = Array(); foreach($out[0] AS $id => $match){ $choices = explode(”|”, $out[1][$id]); $toFind[]=$match; $toReplace[]=trim($choices[rand(0, count($choices)-...

IE - Javascript to change IMG SRC cancels existing loading bar

Hi there, I've come across an obscure problem where many of the pages on my company's website take several seconds up to several minutes to load. Ordinarily, one would expect a browser's native progress bar to continue spinning until all outstanding requests have finished, but IE will stop the progress bar when ANY request returns. And...

Need help converting this inline javascript to a jQuery function

I have the following HTML/JS that shows an initial value, removes it when you click in the input field, and then re-populates it with the original value if you don't enter anything. I need to do this on multiple input fields on the same page and thus would like to turn it into a jQuery function that I could then apply to any input fiel...

Is it true that first line of Javascript will be executed only after all script tags with src attribute are downloaded and evaluated?

By first line of Javascript I meant the JS code inside tags with no "src" attribute. ...

select the text in a text field when clicked?

how can you so that the text in the text field is selected when the user clicks on the text input field? i have used this code: $("input[type=text]").focus(function() { $(this).select(); }); but it doesnt work in safari. and in FF it works sometimes. ...

How to make something similar to Time-Machine in a web page

Hi, I want to implement something similar to MAC OS X Time Machine in terms of having time-line on the page side and then clicking on a specific day will pull a page from the server. I have good experience with Ruby on Rails. I'm less experienced with GUI design and was wondering what in your opinion is the optimum way to do something ...

How do etherpad & Google Docs do ChangeSets

I'm curious to learn how Etherpad and Google Docs automatically save data. When you're writing a text document the products send only the changes to the server. Any idea how this technology works and where I can go to learn more about the end-2-end? Thanks ...

Trigger function based on result of custom function Referring URL

I need to use javascript(jquery if applicable) to trigger my modal call if the result of my function is true and the referring URL is not of the domain The desire is that the user visits the main splash page and as long as they have not been redirected there by the site itself (via timeout on session, invalid login credentials, etc) it ...

Javascript code for handling Form behaviour.

Hello, Here's how the situation looks : I have a couple simple forms <form action='settings.php' method='post'> <input type='hidden' name='setting' value='value1'> <input type='submit' value='Value1'> </form> Other small forms close to it have value2, value3, ... for the specific setting1, etc. Now, I have all these forms placed o...

proper sequence of functions when coding in js

I am using jquery and am really frustrated at how I write my code. I started coding in JS and Jquery a few months ago and my code looked like this: $(document).ready(function(){ $(function(){// a function that applies a plugin to an element}); $(function(){// another function that applies a plugin to an element}); $(function(){// and...

Chrome User Script Checking for new Tweets

Hey guys, so I have a tab for twitter.com open all the time in Chrome and I've written a userscript that checks the document title every so often for new tweets. Since the Twitter web interface automatically checks, it will show (2) Twitter / Home as the title if there are two new tweets. Everything works as I want it to, and right now I...

JavaScript +css - Change main category's checkbox css, if any items beneath it are checked.

All, I have the attached code snippet where a category checkbox is checked if all items underneath it are checked. How can I modify the code such that: If any checkbox underneath any category is checked, the CSS Style of it's parent "Category" checkbox should look greyed out. (I do not want to disable the checkbox. Just look grey or a...

Adding Combo-box dynamically

Howdy folks.. I'm trying to design a table in HTML which can add a row when I click "add row" button & the same for deleting an added row if i intend to delete it. I have written a javascript for adding checkbox and text. But I want even combo-boxes in it and I m stuck in the middle. Could you guys just figure it out and let me know ho...

How can I load my own js module with goog.provide and goog.require?

We are trying to switch the packaging for our project from dojo to google closure, but we haven't had any luck so far. Here is a simple example that illustrates what we are trying to accomplish: <html xmlns="http://www.w3.org/1999/xhtml"> <head> <script type="text/javascript" src="runtime/src/core/lib/goog-rev26/base.js"></scr...

clearTimeout does not work in ondblclick event in FireFox

I'm trying to have an element which support both click and double click on it. But the following example works in IE but does not work in FireFox 3.5.6: <button onclick="c=setTimeout('alert(1);',1000);" ondblclick="clearTimeout(c);alert(2);">Test</button> It just doesn't clear timeout, so alert(1) is being fired. Does anyone know what...

jQuery UI Dialog, adding elements next to a button

One of the nice things about the jQuery UI Dialog is that it has an option for Buttons, which automatically positions them correctly. I just wonder: Can I somehow place elements next to the buttons? I have a little Ajax-Loader gif that I would like to display in the lower left corner of the dialog, while the buttons stay at the lower rig...

Java Script and AJAX

I have knowledge of Java script and had enough experience,kind of planning to step into AJAX im looking for an IDE in which i can learn AJAX and are there any plug-ins for net beans for AJAX with inellisense. ...

Can I set the type of a Javascript object?

I'm trying to use some of the more advanced OO features of Javascript, following Doug Crawford's "super constructor" pattern. However, I don't know how to set and get types from my objects using Javascript's native type system. Here's how I have it now: function createBicycle(tires) { var that = {}; that.tires = tires; that....

Disabled the a tag (link) by using javascript

Does anyone how can I disabled the a tag (link) by using javascript? Example: <div class="sub-heading"> Contact Details &nbsp; &nbsp; &nbsp; <a href="./cust_add_edit_customer.php?action=edit_customer_details&amp;cust_code=12761"> <img class="imgVA editIconPad" src="../images/edit0.gif" alt="Edit Contact Details" bor...

resize div zoom in zoom out using pure javascript or jquery

hi i have a page displaying a swf game within a div container i need to add a zoom in zoom out slider to this page so user can resize the swf file using a slider an example like this page slider : like this page http://www.agame.com/game/Snowflake-Puzzle.html any help please Thanks on advance ...