javascript

Javascript: Suppress "Stop running this script?", or how to use setTimeout ?

I'm building a js library that reads binary files, including zip files. Because there's no direct native support for arrays of binary data, when the zip files get large, there's a lot of copying that has to go on (See my other question for details). This results in a "Stop Running this script?" alert. Now, I know this can happen ...

JavaScript window.scroll vs. window.scrollTo?

Any idea what, if any, difference there is between window.scroll(x, y) and window.scrollTo(x, y) [not talking about jQuery]? Also any ideas as to which browsers support which? Thanks ...

Problem with jQuery - error when trying to find 2 tags

Hi all: I have the following DOM structure: /*:DOC += <div id='testDiv' class='testDivClass'><div id='innerTestDiv'></div></div><span id='testSpan' class='testSpanClass'><span id='innerTestSpan'></span></span> Now I tried to run jQuery select against them as follow. The first one returned alright, but the second one failed: // work...

Dojo dnd input box

I'm trying to move the contents of an input box using Dojo DnD, so the HTML looks something like this: <div id="input_box"> <input type="text" class="my_input_box_style" /> </div> And the JavaScript looks something like this: var dndSource = new dojo.dnd.AutoSource(dojo.byId("input_box"), { singular: true, copyOnly: true, sel...

jQuery effects disappear after ASP postback in Firefox

I have a ASP updatepanel, within that panel I have some controls which got jQuery effects connected to them. The effects work perfect before posback, after postback the effects only work in IE not in FF. To get it working in IE I added the following to my MasterPage: function pageLoad(sender, args) { // Initialize jQuery effects. }...

Javascript focus on browse button of file input

I am trying to focus on the browse button of the file input control. so I have something like <input type="file" name="upload" id="upload" > and in javascript I have document.getElementById("upload").focus(); but the focus remain on the text field and comes to browse button only after i hit tab. Is there a way that I could write ...

Declaring functions in JavaScript

Possible Duplicate: Javascript: var functionName = function() {} vs function functionName() {} What's the difference between these two ways of declaring a function? function someFunc() { ... } var someFunc = function() { ... } I'm not asking in the technical sense. I'm not asking which is better for readability, or which sty...

JQuery shortcut for callbacks like function(){ mycallback() }

Hi javascript developers, Is there a way to reduce the boilerplate required to define a function in jquery? (My example is with a callback but it could apply to any anon function.) $('#dialog').load('/index.cgi',{p:'myform'}, function(){ ajaxify_form() }); What I would like is to do $('#dialog').load('/index.cgi',{p:'myform'}, ...

Optimizing image load times. (thinking differently)

I've created an interactive image thing...but it takes a little too long to load. The interactive image thing is located at: southernwindowdesign.com It uses 5 images to step through each state (by clicking and dragging). I want to keep the images high-quality; so, any further jpeg compression is out (including punypng and smush.it)....

Z-Index Transaparent Image

Hi, Hoping someone can assist but I need to take an existing banner image that has, as part of the image, a company logo at the left hand side of the image, but the whole banner is an image. Now what I am after, is a means of creating a layer region (transparent/invisible) over the existing image logo, so that: A) the orginal image ca...

Hide all the id in JavaScript

I need to hide all the tags which has the ID 'media' E.g.: `<div id='media'>contents</div>` `<div id='media'>content</div>` How to do this using JavaScript? ...

Loading my Greasemonkey script after another GM Script Loads

I have two greasemonkey scripts loading on a particular url. How do I make sure my second GM script doesn't load until the first GM script completes building it's page elements. Also how do I control the order in which the GM scripts load/run? ...

Get browser version of IE using Javascript

I am using the following code to get the version of IE in a system. var browser = navigator.appName; var b_version = navigator.appVersion; var version = parseFloat(b_version); alert(version); But the version always get is 4 in IE^ and IE7. How can I get the exact version? ...

replace multiple values+in SQL query?

I want to do searching for data using users' entry in a field. That is if user enters "D+t+y+g,k,j,h" want to search for values having letters "d and t and y and g or k or j or h". I tried the PHP str_replace function, but didn't like the result. //kw is text field... if($kw != "") { //here we check for some data in field; if yes, c...

apply plugin to a new element in the DOM (jquery)

I am using the jquery tablesorter plugin and applies it to a table with id : #table my search facility requests for results via ajax and replaces the table with a new table of the same id if my code is like this : $('#table').tablesorter(); what do I add to apply to make the plugin work on the new table? (I know of jquery's live eve...

Passing array of bytes from ActiveX to javascript and vice versa

Hi all, I need to pass data (byte array, i.e char*) from ActiveX object (using Visual C++ with ATL) to my javascript code (and vice versa). I've digged the Web for such problem and tried lots of solutions but have not succeeded. I've tried the followings: Converting char* to BSTR and pass it to javascript (JS), but my result in JS is ...

how to find out html textfield field focus in .js file

i want find html textfield blur or focus through .js file ...

tracking download completions from a website/cdn

I have a Drupal website where users are clicking on a link that initiates a file download from a content delivery network (CDN). A script is tracking the number of users who click the link to begin the download process. I'm looking for suggestions on how I might track the number of users who successfully complete the download process. ...

Javascript - return false error

Hi Everyone I have a form validation function that loops through the form elements checking for empty fields - code below: function formValidate(ourform){ var formelems = document.getElementById(ourform).elements; for (var i=0; i<formelems.length; i++){ if(formelems[i].value == "") { alert("Empty Field(s). Please fill in all ...

About Events to Textbox and Div

I have assigned a onClick event to textbox. When I am clicking on textbox, I want to execute the click event of div also. How to do that in Javascript?. The div and textbox are not nested they are on different position in document.And thanks in advance for the Help. ...