javascript

how can i detect if a page on safari was opened from the springboard?

i saw it once and i cant find it again: how to detect via JavaScript if an iphone webapp was opened from a url typing or from an icon in the springboard? thanks! ...

I need to use Prototype to do something I can easily do in jQuery

I know my jQuery, but sadly don't know much about Prototype. $(function() { $('#home-gallery-container').append('<a href="/images/cobra_sale.jpg" alt="" rel="lightbox-home" id="special-home" ><img src="/images/tag.png" alt="Special" /></a>'); }); How would I do this in Prototype, or Magento's library if that adds anything extra. ...

How to use JQuery to highlight text.

Suppose I have this HTML code: <div class="person"> Mike Mulky </div> <div class="person"> Jenny Sun </div> <div class="person"> Jack Kickle </div> This JQuery thingy will actually filter the matching query. For example, when a user types in a textbox. $('#userInputTextbox').keypress(function(){ $('div.person').hide().filter(':...

Kill a Javascript process after a set amount of time

I apologize if this is a duplicate. Let's say I have a JavaScript function that calls a web service to pull some data. I use some kind of moving graphic to let the user know it's working. When it is successfully retrieved, I change the graphic to a check mark. Here's my code: getData: function() { $("#button").attr("disabled", "tru...

Creating a simple drawing area widget with google closure.

Here I've tried to create a simple drawing area widget containing a single circle, using google closure. I load it by calling sketcher.load() within html script tag and get an error: Uncaught TypeError: Cannot set property 'Widget' of undefined - what is not right here? goog.provide('sketcher'); goog.require('goog.dom'); goog.require...

Web UI: Dynamic Web Forms

consider the following data structure: subject (stdClass) topic (stdClass) units (int) title (varchar 50) description (varchar 255) start_time (time) end_time (time) teacher (stdClass) first_name (varchar 50) last_name (varchar 50) students (stdClass[]) 1 (stdCl...

Check Value of a FORM POST on submit using jquery

I have 3 buttons <input type="submit" name="submitButton" value="something">. Then i check the event with $(".form_name").submit(function(e) { and i would like to check which of the 3 buttons have been clicked and to alert the user of the action and return false if the user wishes to not go through with the action. How do i check which ...

Simple JS slideshow that will work with N entries

I would like to create a simple javascript slideshow that allows a user to click 'Previous' or 'Next' and have the element slide in from the right or left depending. Content will be coming in from a CMS, so it's not 'hard-coded' persay. My markup would look like this ideally (where the most recent entry receives the 'show' class): <span...

How to change A's html site when B does something.

Say we have users A and B which visit the same URL containing a button. When A clicks on the button, I want something on B's website to change immediately while B is on it, e.g. a text to be added. I want this to happen with a delay of less than 150ms. Is this realistic? Could you give me hints as to what I should search for, or toy exa...

asp.net mvc dynamic javascript menu

is any library to allow create dynamic javascript menu from code ? ...

How can I have multiple document.observe(dom:loaded ...) functions inside one javascript file? (prototype)

Hi, Basically what I'm after is, following squashing all my JavaScript into one file (or a few files) how can I make a document.observe(dom:loaded({...})) function call for the right page? So, say I have 5 pages in my website, and each one has a separate JS file. Inside each file is a load of page related functions, and a special funct...

Jquery Cycle Div as Anchor

I'm building a page that has a few divs of content that will slide in and out - just a few lines of code with jQuery Cycle. I have a navigation on the side in which I want to append the links to. No problem with Jquery cycle - I can even specify an image or H3 tag that I want to use. However, I want to append an entire div from the sli...

jQuery slideshow loop fail

Hi, I've been trying to implement snook.ca's Simplest jQuery Slideshow, but when applied to child elements inside a <ul> instead of a straightforward stack of images. I've successfully got the slideshow rotating through the necessary child elements, but I've run out of know-how when ending the sequence and returning to the beginning. I...

Using the Google maps API with JavaScript or PHP?

i've read that you can use either javascript or php with google maps api. so what are the pros and cons for each of them? and if i got the geocodes stored in a database. should i get them with ajax and process them with javascript or should i use php? it says in the FAQ that 15000 requests are allowed per day per ip. does this mean tha...

Disable the button after clicking the button once

Hi All, In my application i need to disable the button once it is clicked so that user should not click more than once. APplication is MVC ASP.NET i have done this in normal asp.net application. I tried below lines of code but its not working thanks in Advance edited How can i implement this using javascript ? ...

how to display new window in current browser window (html)?

Hi, I am trying to create an embedded <script> containing a function called "showForm()" that displays the contents of a file called "form.htm" within the main browswer window. This is what I need to do: Display the form.htm file in the browser window that was used to open the cover.htm file. (hint: use the "opener" keyword to refere...

Calling a method in a Javascript Constructor and Accessing Its Variables

I am trying to call a method from the constructor of my javascript constructor, is this possible and if so, I can't seem to get it working, any insight would be great! Thanks! function ValidateFields(pFormID){ var aForm = document.getElementById(pFormID); this.errArray = new Array();//error tracker this.CreateErrorList(); } ...

Passing a string with apostrophe to javascript function

I have a situation where I need to pass a string with an apostrophe in it to a javascript function. This function then takes the string and uses it to find the element by id in the DOM. As an example, I need to call: showElement('what's') function showElement(element_id){ document.getElementById(element_id).style.display = "bloc...

How can I get the width of a layoutUnit that doesn't include its scrollbar?

I'm trying to make my layout update the width of another element, but I need to get at its width NOT including its scrollbar (if one is indeed present). getMainContentBounds() in this case seems to be returning the entire width along with the scrollbar. I have also tried getSizes() with the same result. myDataTable.on('postRenderEvent'...

In Firefox, double-clicking on an a tag with href set to # but with onclick set to bring us to another page will effectively make us remain on the current page

Suppose we have the ff. in a.html: <script> function onClick() { // Do some important stuff and then... location = "b.html"; } </script> <a href="#" onclick="onClick();">Link</a> Double-clicking on Link will trigger the event-handler onClick. However, the second click in the double-click seems to be interpreted as another...