javascript

javascript - get all anchor tags and compare them to an array

I have been trying forever but it is just not working, how can I check the array of urls I got (document.getElementsByTagName('a').href;) to see if any of the websites are in another array? ...

Xul - javascript tabs and url

Hi, I'm training to get the address of all open tabs in firefox with no success. My problem is to open a tab if there's no already open, so I should search an address into tabs, and if there isn't, add one. Thanks ...

Asynchronous method queue in Javascript

I am attempting to implement an asynchronous method queue in Javascript as seen in this blog post Here's what I have so far: function Queue() { this._methods = []; this._response = null; this._flushed = false; } (function(Q){ Q.add = function (fn) { if (this._flushed) fn(this._response); else this._methods.push(fn); ...

jquery: function to end another function

$('#start') executes the function myFunction() and $('#stop') end it. How do I stop myFunction() from executing? function myFunction() { $(document).mousemove(function(e) { $('#field').html(e.pageY) }); } $('#start').click(function() { myFunction(); }); $('#stop').click(function() { //stop myFunction })...

Preventing form submission with Dojo

Hello, I have a Dojo SubmitButton with jsId="saveParamButtonWidget". I overrided its onClick method by putting: saveParamButtonWidget.onClick = editParam I defined the editParam() function like this: function editParam(eventObj) { dojo.stopEvent(eventObj); // ... } dojo.stopEvent() is supposed to stop event bubbling and de...

Firefox remove basic authorization info

As you know Firefox remembers the basic authentication info for a user once the user logs in. How do I remove this programmatically using javascript? Scenario: User logs in An ajax request using basic authentication is sent to the server If successful, firefox then remembers authentication info If user logs out, firefox still remembe...

Not able to call a function onfocus event in php

Hi there , I am not able to call a functions on onfocus and onblur events, both perfectly working in html but not in php here is code in php: echo "<input value='Enter Name' onfocus= 'areaOnFocus(text1, 'Enter Name')' onblur='areaOnBlur(text1, 'Enter Name')' type='text' name='text1' id='text1'>"; both functions are called in script t...

Javascript debugging difficult as browser doesn't refresh the scripts!

Hi, I'm trying to debug a Javascript written in the Mootools framework. Right now I am developing a web application on top of Rails and my webserver is the rails s that boots WEBrick. When I modify a particular tree.js file thats called with in one a mootools init script, require: { css: [MUI.path.plugins + 'tree/css/style...

Stop page from scrolling when intercepting key presses like space and arrows

I'm using JavaScript and Prototype and catching the key presses from the user. I successfully catch return, space and arrows with code like this: Event.observe(window, "keyup", function(e) { switch (e.keyCode) { case Event.KEY_RETURN: case Event.KEY_RIGHT: case 32: // space // do something break; } }); My ...

Using the tumblr api how do I return a permalink?

If I used the api to post, I would like to return back the Tumblr permalink for that site I sent it to. ...

Avoid repeated image retrival from server

Hi! I am new to web design. Please correct me if my understanding is wrong. I am seeking advices that can avoid the round trip between browsers and server in the following scenarios. Imagine javascript first downloads all 30 ~ 50 images from server. These images are then used to build the thumbnail images, each in 60px by 60px or so si...

How to customize print size in .net for a short receipt?

I want to print a short receipt in receipt printer, however, i print a whole long web page size. I refer to the method searched in google and make a dll and register. However, get a automation error can not create object. THen i regsvr32 scrrun.dll and set allow intialize not safe activex control in internet explorer it still get the...

Precedence of function object expression in ECMAScript

In order to implement a tiny compiler that emits ECMAScript I need to know how strong a function object expression binds, i.e. what is the precedence of the "operator" function(a1, a2, ...) { ... }? For example, how is function(a1, a2, ...) { ... } (b1, b2, ...) supposed to be parsed? To get the wished for result, namely the application...

How to display other sites content in our sites with out using iframe?

How to display other sites content in our sites with out using iframe? Is it possible to load one sites file details in our site with out using the iframe. any body knows the solution please help me with a sample code? ...

RTL Comfirm and Alert in Javascript

Can you make a confirm function show it's message RTL and right aligned? ...

Change dimensions of body with JavaScript

How can I change the dimensions (width, height) of the body element after the content has been loaded? Restrictions: Only targeting WebKit browsers Can't use frameworks like JQuery Can't make changes to the original HTML file; only execute JavaScript after the content has been loaded. ...

How can I use google maps API to return a journey time with AND without traffic?

I'd like a way of being able to calculate journey time WITH and without traffic, so I can work out the difference so I know how much the traffic is delaying you by. Also, is there a way of doing it based on a selected date and time? As I know google has this feature, just not sure if their API has made it available. Is it possible witho...

Should I check for the class before adding or removing it in prototype?

I have a line of code in JavaScript, using prototype, that is run several times per second. This line of code, depending on the state of some variables, would ensure that certain element has or has not a class. My question is, should I blindly add or remove the class or should I check for it first? Should I have this code: if (!element...

JQUERY/JS: Simple OCR for a simple math operations

Hi to all Dear Coders, i have opened this new question because i would like to make a simple script in Jquery or Javascript that read from very simple images the figures. This is an example of image: And this is an easy tutorial how to make: TUT Math Image And then i have see this script that read all phrases: Megaupload auto-fill ...

How to get asp.net client id at external javascript file

Hello. when i use embedded javascript functions i can get client id of elements with this code for example : document.getElementById('<%=buttonXXX.ClientID%>' ) but now i am using external javascript file for caching and faster rendering but this code does not work any more for getting client id's of elements it gives error how can ...