javascript

Recommendations for AJAH Library

I have a classic ASP application I would like to add some AJAX-style partial page updates to avoid server roundtrip. For example, list of rows displayed, option to add another in-situ, save it, and table redisplayed / add another. I don't think I need all the other baggage of the well known AJAX libraries I would appreciate suggestio...

Howto: PHP/Javascript communication

As I'm developing my WebIDE, I keep coming up with questions that I cannot answer myself. This is because the project is supposed to help others create what they would "normally" create, but faster (i.e. as automated as possible). In this light, my question is how to you implement a PHP backend? Here is what I do. I like to create "f...

Google translate breaks button that makes javascript function call

Hello all, I have site that works fine but when i put it through Google translate my button that initiates a javascript function doesn't work. However, some other Javascript calls via links work. Whats wrong? Example translation Thank you for any help. Update The sister site is even worse, the whole left side goes white?? Wait for ...

Adding event handler to an iframe using JQuery

I want to assign a keydown event handler to an iframe. Something similar to the pure JS: document.getElementById('iframe_id').contentWindow.addEventListener('keydown',funcName, true); I tried: $(document.getElementById('iframe_id').contentWindow).keydown( function() { // my func }); But it does not work.. Please help! ...

Should PHP frameworks generate JavaScript?

I've noticed that a PHP frameworks; Zend, Cake, and Symfony; seem to either generate JavaScript or allow it to be embedded as a string into the PHP itself. Is this a good idea? From people who've used these frameworks/libraries, what has been your experience working with the Ajax and JavaScript helpers? Has it been easy to maintain? Does...

How to dynamically change shortcut key in Firefox?

I have a firefox extension which can be activated by a shortcut key. I want users to be able to change the key combo dynamically. My XUL looks like this <keyset id="ksMain"> <key id="keyDoMyThing" modifiers="control,shift" key="e" command="cmdDoMyThing"/> </keyset> cmdDoMyThing is a reference to an element in a commandset. When I...

JS File Not Being Executed

<script type="test/javascript" src="/js/something.js"></script> Nothing looks out of place there, right? Then what's going on that, in Firefox, Chrome, Steel, Android Browser, and IE 6, the page loads and does not execute anything in schedulegrid.js? Even if it is just a single alert() call: nothing. Firebug shows the correct contents ...

Is it valid to replace http:// with // in a <script src="http://...">?

I have the following tag: <script type="text/javascript" src="https://cdn.example.com/js_file.js"&gt;&lt;/script&gt; In this case the site is HTTPS, but the site may also be just HTTP. (The JS file is on another domain.) I'm wondering if it's valid to do the following for convenience sake: <script type="text/javascript" src="//cdn.ex...

Focus on a non-input/anchor element?

I'm working on some JavaScript that requires a tag that can get focus. I'd like to be able to use a <div /> tag, however <div /> tags can't get focus. It looks like the only elements that can gain focus are <input /> tags and <a /> tags. Is there any other way to allow an element to gain focus that isn't an <input /> or <a /> tag? I ca...

Single line select box with up/down arrows like in a multi line select box

Basically, I want this: <select size="2"> <option>1</option> <option>2</option> <option>3</option> <option>4</option> </select> But instead of having two lines, I want it on a single line. Can this be done without Javascript? If not, I would imagine it's common enough (though I can't find any relevant links on Google)...

JavaScript Scroller Problem

I'm trying to incorporate the following JavaScript Scroller into a website but as soon as I include it in a HTML page that has layout eg. Tables/DIVs it seems to break and won't display. Was wondering if anyone had any advice. <script language="javascript"> //ENTER CONTENT TO SCROLL BELOW. var content='Content to be scrolled'; var boxh...

How do you make an HTML document writable in the browser?

Lest my question is not clear; I don't mean dynamically replacing nodes with . I mean editing each and all text directly - including headers, text in and and yes editing tables. I know this is possible in IE and I have a script which switches between editable and back which works in IE, but that doesn't work in FireFox. Is there any w...

Beginning jQuery help

I'm trying to make a simple MySQL Admin thing with php and jQuery. I've never used jQuery so my code is probably quite lol-worthy. The problem I'm having with the code is that when I click the button, nothing happens. I know the even fires because if I open the html file in firefox (not going to the url, using the file:/// thing) and cli...

How to terminate the script in Javascript

I neeed a code that will exit the js script much like PHP 'exit' or 'die'. (I know its not the best programming practice but I need it). ...

Best technology to allow consumers of my website to incorporate dynamic data into their website

What I am asking, is what is the best way (i.e. the way that is easiest for neophyte web developers) to consume/integrate data that I make available on my website, into their own website. I have a website written in asp.net/sql server back end. I have clients that would like to be able to incorporate selections of data (say for example...

Should a animated header be in flash or javascript?

I work at a small website building company and on one of our clients website we have a flash animation in the banner. The animation is rather chunky being 4 megabytes. The client has recently requested a rebuild of the site which would again include an animated header. We were thinking about this time not building the header in flash (or...

Tab or accordion based page - how is it done in the server side?

I have a web page with tabs or accordion, generated with YUI or jquery or another javascript+css framework. Say an HTML form is processed in one tab. What should the server do? Send back all the tabs, with the tab that submitted the form having the results and all the other tabs unmodified? Or what? ...

Greasemonkey Script and Function Scope

Here is my script code: // ==UserScript== // @name test // @description test // @include http://* // @copyright Bruno Tyndall // ==/UserScript== var main = function() { var b = document.getElementsByTagName('body')[0]; var t = document.createElement('div'); t.inn...

Lets solve cross-domain ajax, totally on the client, using script tags.

I know, there's JSONP, which involves server cooperation to name-space the data. What is bothering me is the fact that the content of script tag src is evaluated, but it's NOT available to read. <script src="http://www.google.com"&gt;&lt;/script&gt; All we need to figure out is how to namespace the data, that's all. Of course I tried...

how to overcome IE bug when dynamically attaching div to body from script

UPDATE: the HTML was not well formed. This was causing the script to appear in inner div. Please ignore the question. IE ver<8 has a known bug (Internet explorer cannot display the page. Operation aborted) If a script tries to append something to upper level block: The bug is described here: Update: I rephrased the question and simp...