javascript

What is the best library to create an AJAX auto-suggest textbox in a web form?

I'm creating a web application for work where the user has to enter the name of the person that requested the job. I'd like to create a simple AJAX auto-suggest dropdown so they don't need to type the entire name. On the backend, the database will provide suggestions based on previous entries. The website is built using CakePHP 1.1. ...

Accessing HTTP Headers in Javascript?

How do I access the HTTP response headers via JavaScript? Related to this question, which was modified to ask about specifically accessing browser information. ...

How to embed fonts in HTML?

Hi all, I'm trying to figure out a decent solution (especially from the SEO side) for embedding fonts in web pages. So far I have see the W3C solution, which doesn't even work on Firefox, and this pretty cool solution. The second solution is for titles only. Is there a solution available for full text? I'm tired of the standard fonts for...

How to program a text search and replace in PDF files

How would I be able to programmatically search and replace some text in a large number of PDF files? I would like to remove a URL that has been added to a set of files. I have been able to remove the link using javascript under Batch Processing in Adobe Pro, but the link text remains. I have seen recommendations to use text touchup, w...

How best to "turn off" a web page from another part of the application?

We have a web application that manages inventory for our computer support group. One of the things that we will be using this for is to drive a "Computers Currently In Use" map for our larger computer labs so that users can find an open computer more easily (the lab in our Main library has around 150 computers). The image used for the ...

JavaScript: How to simulate a click to make the current input lose its focus

I have an input which at some points happens to have the focus. If the user click in the "background" of the page, the input loses its focus. I was trying to simulate the click on the background with the following code, but this doesn't work (you will notice that the input still has the focus). Any suggestion on how to write code that si...

Is there a best practice for generating html with javascript

I'm calling a web service that returns an array of objects in JSON. I want to take those objects and populate a div with html. Let's say each object contains a url and a name. If i wanted to generate the following html for each object: <div><img src="the url" />the name</div> Is there a best practice for this? I can see three w...

Best AJAX TreeView

What are some of the better AJAX Treeviews out there that support asynchronous JSON loading. YUI TreeView seems nice, but bloated with tables, etc. ...

auto-refreshing div with jquery

how exactly do you make an auto-refreshing div with javascript (specifically, jQuery) ? I knew about the setTimeout method, but is it really a good practice ? Is there a better method ? function update() { $.get("response.php", function(data) { $("#some_div").html(data); }); window.setTimeout("update();", 10000); } Thanks be...

javascript image rotator issue, default image

I wrote a simple javascript image rotator which picks a random image on each page load. The issue is that if i use a default image, that default image will show up for a second before the javascript loads and replaces it. Obviously if someone has javascript disabled i want them to see an image. How can i have a default image without a f...

Convert Javacript code to VBScript code?

I have been given a task to convert code that is written in JavaScript over to VBScript. It is actually quite basic code and it is really just the syntax that needs to be converted. For example if (str == "string text") { foo = "foo"; } else { foo2 = "foo2"; } becomes If (str = "string text") Then foo = "foo" Else foo2...

Flash inside a scrolling div - IE6 bug

I have div containing a list of flash objects. The list is long so I've set the div height to 400 and overflow to auto. This works fine on FF but on IE6 only the first 5 flash objects that are visible work. The rest of the flash objects that are initially outside the viewable area are empty when I scroll down. The swfs are loaded ok be...

JQuery and frames - $(document).ready doesn't work

Hi, I have a page, with some code in js and jQuery and it works very well. But unfortunetly, all my site is very very old, and uses frames. So when I loaded my page inside a frame, $(document).ready() doesn't fire up. My frameset looks like: <frameset rows="79,*" frameBorder="1" frameSpacing="1" bordercolor="#5996BF" noresize> <fr...

How do you get a timestamp in JavaScript?

Something similar to Unix's timestamp, that is a single number that represents the current time and date. Either as a number or a string. ...

Width of an element accounting for quirks mode in javascript?

I've been scanning through all the popular js libraries, but I can't find one that has a width function for a DOM element that actually accounts for quirks mode in Internet Explorer. The issue is that padding and borders don't get counted in the the width when quirks mode is engaged. As far as I can tell this happens when the doctype is ...

Connecting to Microsoft Dynamics CRM 4.0 from a legacy ASP application

I have a legacy ASP application written in JScript. At the moment it uses its own database tables for user accounts and authentication. The customer data for this app is being moved into Microsoft Dynamics CRM 4.0, and I need to modify the ASP site's authentication to look up user credentials in Dynamics CRM instead. Here's the possible...

Javascript and PHP functions

Is it possible to call a function from PHP using onsubmit from javascript? If so could someone give me an example of how it would be done? function addOrder() { $con = mysql_connect("localhost", "146687", "password"); if(!$con) { die('Could not connect: ' . mysql_error()) }...

How do I confirm a browser window is open, with Javascript?

I'm opening a new browser window from my site for some of the members. However, some may later close it, or it might have initially failed to open. Is there a snippet of fairly plain Javascript that can be run on each page to confirm if another browser window is open, and if not, to provide a link to re-open it? [clarification:] The co...

What does the plus sign do in 'return +new Date'

I've seen this in a few places function(){ return +new Date; } And I can see that it is returning a timestamp rather than a date object, but I can't find any documentation on what the plus sign is doing. Can anyone explain? ...

Geolocation API on the iPhone

Does anyone know whether the iPhone supports or will soon support the W3C Geolocation specification? I'm looking to build an app for mobile users, but rather than spend the time developing apps for every different platform (iPhone, Android, etc...), I'd much prefer to create a web app that makes use of the W3C Standard. ...