javascript

Prevent Safari from losing selected text in the body on button click

I have an application that passes any selected body text to a text-2-speech server (via ajax) when a "Say It" button in the parent window is clicked; the selected text is in an iframe. The selection works on Firefox 3.6 and IE 8, but not Safari 5 (have not tried any others; thats our supported browser list). In Safari, whenever the bu...

Bookmarklet to make session cookies expire later

Background: There are several sites that I visit regularly on my iPhone that require me to log in. Unfortunately, the sites set cookies that expire at the end of the session. This unfortunately means I end up having to log in up to a dozen times per day. I would like to write a bookmarklet that will go through and change all my 'expires...

text replace with jquery

So im using jquery to search and replace certain text in my html page. Which is: function offon(){ $("#sidebar li").each(function(){ $(this).html($(this).html().replace(/Off Premise/, "Liquor Store")); $(this).html($(this).html().replace(/On Premise/, "Bar/Restaurant")); }); } This is the createmarker function, it uses a...

iPhone Cursor Magnifier

I don't suppose there is a way to trigger the native iPhone magnifier on static content in the way I need. Is there a library that would simulate (visually) the iPhone magnifier effect for any element when being tapped on for a while and returned the cursor (i.e. magnifier) position within the element? Just asking before I start writin...

Javascript Dialog box w/ Multiple Buttons

Hi, Is there a type of Javascript dialog box (similar to alert) that offers customizable, multiple buttons (besides "OK") and will return some sort of indication of which button was clicked? I am not looking for a JQuery or third-party dialog/modal box, I'm just wondering if there's something already built into Javascript. As far as I'v...

jQuery / PHP - sort html list by PHP array values?

I have a list like this: <li> <input value="1" name="bla[]" /> </li> <li> <input value="2" name="bla[]" /> </li> <li> <input value="3" name="bla[]" /> </li> (always the same order) and a array like this array('3', '1', '2'); but the order of the values in the array can change anytime. Can the list above be sorted with jQuery based...

Setting the value of a hidden input

The idea: I'm setting the value of an input with type="hidden" via regular Javascript or jQuery. The issue: neither jQuery nor document.getElementById will find the hidden input, even though I'm absolutely sure the selector is correct and there are no conflicting elements. The code: I can't really post much of it, because it's full of ...

How to randomize an integer variable using JavaScript?

How can I randomize a variable in JavaScript between 0-4, so that every time the page loads the variable is different but between 0 and 4? ...

HTML checkbox onclick called in Javascript

Hello, I am having a bit of trouble trying to figure out how to get a certain part of my code to work. <input type="checkbox" id="check_all_1" name="check_all_1" title="Select All" onclick="selectAll(document.wizard_form, this);"> <label for="check_all_1" onclick="toggleCheckbox('check_all_1'); return false;">Select All</label> This i...

Firefox does not support JavaScript (form validation) but IE fully support.

Hi everyone! I developed a user input form in php used (php, html, javascript…). I wrote validate functions in JavaScript. The form is working fine in internet explorer and validate all the fields, but when I open in Firefox then, the form and fields not validate like (drop down menu field) not validate, but why? I am new in web developm...

Ajax auto-complete, with bespoke popup location

I'm doing something that involves ajax auto-completion of phrases in a <textarea>. I've got this working well using the jquery autocomplete plugin; however, it is hard-coded into this to position the popup below the <textarea>. For what I'm working on, the <textarea> is at the bottom of the page; I ideally want the options to appear abo...

Javascript e-mail validation of specific domains

I can’t figure out what is missing so that when e-mail is valid it will skip the last invalid message and move to next item on form for validation: enter code here if (document.form1.email.value.length > 0) { var tst = document.form1.email.value; var okd = ['bankofamerica.com','baml.com','magner.com','ml.com','ust.com','us...

Is there anything like an audio equivalent for <canvas>?

I'm wondering if there are any plug-ins/libraries or awesome tools that would let me script sound/music with javascript in a browser in a similar way to how <canvas> allows you to script drawing and animations. ...

How to scroll to selected item in a select box

In my application when I person selects an item at the bottom of the select box the area is reloaded with another select box. My problem is when the select box is loaded it scrolls to the top instead of scrolling to the selected item observe here http://www.jaunna.com/question/Add UserID: top Pass: t ...

Use Onload or ready?

Hi, In my application i am using $(document).ready() What is the difference between this and $(document).onload() Thanks in Advance Dean ...

how can we change multiview view from client side (with javascript)?

hi my dear friends : is it possible to change multiview view from client side (with javascript)? thanks in future advance ...

JavaScript Image Rotation Firefox Issue

I am trying to implement simple image rotation in JavaScript. With a 500 ms delay, it works as I expect in IE but in Firefox, only the last image in the sequence is displayed in the browser. Firebug shows the Http load status as "Aborted" on all but the last image in the sequence. If I increase the delay to 2000 ms, it seems to work in F...

Python socket server craps out after receiving data

I'm currently dabbling in sockets. I've got a jquery script that uses a very small flash swf file to establish a true socket connection. As a server I'd like to use python. Everything works, but I can only send information to the server just once. I've tried 2 pieces of python code for the server. I guess since they both have the same ...

Why won't this javascript work?

It's been really frustrating me i have this code: <script type ="text/javascript"> scriptAr = new Array(); // initializing the javascript array <?php foreach ($docsannlist as $subdocs) { $lines = $subdocs; // read file values as array in php $count = count($subdocs); //this gives the count of array //In the below lines we...

Proper way to include scripts in an asp.net page

I've got an ASP.NET application that uses a mixture of ASP.NET AJAX (Including UpdatePanel) and jQuery written by several developers of differing backgrounds. Some included scripts within the ScriptManager itself <asp:ScriptManager><Scripts><asp:ScriptReference...., while others used Page.ClientScript.RegisterClientScriptInclude in the ...