javascript

Ajax synchronous callbacks

Hi All, I have a pageTest.html in local folder,this page call a service.ashx?i=...(that return value param passed incremented +1) with follow Ajax code: . . getIncr: function(parameters, success){ $.ajax({ async: false, type: methodType, url: getTarget, data: "n="+parameters, ...

javascript: setting a.onclick doesn't work at first run

Hi, I use code like this to dynamically create some link-based controls: <script type="text/javascript"> function BuildControls (id, ...) { var div = document.getElementById (id); /* some stuff with var sp=document.createElement('span'); */ var a = document.createElement ('a'); a.innerHTML =...

Is there a way to try and load a file in HTML/JavaScript and have a fallback if it doesn't load?

I just switched to start using a CDN for external images/static files for my site and I wanted to know how I could build a backup in case this CDN failed. Is there a way to reference an external link in an HTML/JavaScript file that would let you specify a fallback location for that file if it is unavailable in the first external host? ...

Javascript IE7: Object Expected

I get Error "Object Expected" on line 1, char 1 (where-ever this is) on my script here in IE7. It works fine in Firefox, and the error console prints nothing. I tried multiple ways to call my function but none works: <a href="javascript:doit()">Turingmaschine starten</a> <a href="#" onclick="doit()">Turingmaschine starten</a> What co...

IE6 - Alphaimageloader Link problem

Has anyone found a solution to the IE6 & 7 problem which kills links nested inside an element with the "alphaimageloader" filter attached to it. I've tried various "position" tricks, to no avail. I'm using the Unit Interactive PNG Fix but from what I can gather, it's a problem with alphaimageloader which means it should affect every P...

Javascript Events Not Bubbling Up When Using Text Box Watermark

I'm trying to implement a simple watermark on a text box that disappears when the text box gains focus. I found this jQuery plugin that appeared to work great: http://remysharp.com/2007/01/25/jquery-tutorial-text-box-hints/ The watermark worked just as advertised with this code: <script type="text/javascript" src="/includes/_jQuery/_...

Is there any future for server-side JavaScript?

Is there any future for server side JavaScript? ...

Ways to detect CTRL-N or when a user opens a new window

How can we detect when a user opens a new window. The user is already authenticated and we make heavy use of sessions. We were trying to avoid ctrl-n javascript hooks but maybe that is an option. I am assuming the request is the exact same URL...with CTRL-n? ...

JQuery: How to clone autocomplete fields?

I am using Jörn Zaefferer's jquery autocomplete plugin, and I can't seem to figure out how to make it work when I clone an autocomplete field. It almost works, in that the cloned autocomplete field displays the choices when the I type in text, but I cannot select items. At first I thought it was a browser-compatibility issue, but it happ...

Where is this JQuery wrong?

I want to add the click event to all elements where the `id="violacao": $(document).ready(function () { jQuery('#violacao').click(function() { alert('teste'); }); }); But just the first link responds to the click. This is the HTML generated: <tr> <td><a href="#" id="violacao">40954589</a></td> <td>Perda de Comunic...

BASE HREF, javascript, and Internet Explorer vs. Firefox

Queston: IE and Firefox / Safari seem to deal differently with BASE HREF and Javascript window.location type requests. First, is this an accurate description of the problem? What's going on? And what's the best cross-browser solution to deal with this situation? Context: I have a small PHP flat file sitelet (it's actually a usability ...

Javascript clientHeight and alternatives

I am currently trying to modify a Javascript function that "slides in" a <div>. The script as it is requires you to define the height of the div, so it is mostly useless in dynamically filled <div>s. I found some text on the clientHeight property in javascript, but it would appear that it doesn't support <div>s with display set to none (...

can you asyncronously notify a web browser?

I'm trying to figure out if there's a way I can somehow notify a web browser of an event from a web server. I know Ajax lets you asynchronously make a request to update a section of a page. I guess I could have a timer periodically ask for updates. But, I'd prefer to avoid a polling scheme, if possible. Is there a better way to go and ...

Image onload for static images

I know that for the image onload to work you have to set the src after the onload handler was attached. However I want to attach onload handlers to images that are static in my HTML. Right now I do that in the following way (using jQquery): <img id='img1' src='picture.jpg'> $('#img1').load( function() { alert('foo'); }) .attr('src'...

What do the different readystates in XMLHttpRequest mean, and how can I use them?

XMLHttpRequest has 5 readystates, and I only use 1 of them (the last one, 4). What are the others for, and what practical applications can I use them in. ...

Usercontrol access javascript from a Content's Page's Master Page

Hello all I have a problem. I have a masterpage that all of my Content pages inherit from. Within this masterpage I have a script tag pointing to the javascript file folder "~/Scripts/validation.js" On my content pages I use different usercontrols that require the use of many of the functions within the validation.js file however if I d...

Convert some JavaScript to JQuery

Hi all, I have some javascript code that does the following link.NavigateUrl = string.Format("javascript:MyFunction({0}, {1});", ID1, ID2); So when the link is click MyFunction will be called and the dynamic parameters will be passed in. How can I pass in these params using JQery like: $(function(){ $('#MyLinksID').click(functio...

ASP.NET server side tags vs. JavaScript-based UI and REST

Hi, I've been developing "traditional" ASP.NET applications with server side ASP.NET controls and code behind files, etc. Now I'm exploring several JavaScript libraries like: jQuery, YUI, Ext Js, Prototype. (also it's hard to pick one, but it's another post). All these libraries make client to server communication a lot easier, but they...

Focus OnLoad="document.form_id.form_field_id.focus();" on the iPhone

Is there a way to focus on a text field on page load (on the iphone)? I tried: OnLoad="document.form_id.form_field_id.focus();" on the iPhone Simulator but it didnt work. Does anybody now why this doesnt work and if so is there a work around? ...

How can I check the security of my website?

How can I check the security of my website? What are the best ways to avoid security holes? ...