javascript

Handle session timeout in asp.net using Javascript

Essentially I want to be able to catch when a user lets their session timeout and then clicks on something that ends up causing an Async postback. I figured out that if I put this code in my Session_Start (in Global.asax) then I can catch a postback that occurred during a session timeout: With HttpContext.Current If TypeOf ....

How can I detect an address bar change with JavaScript?

I have a Ajax heavy application that may have a URL such as http://mysite.com/myApp/#page=1 When a user manipulates the site, the address bar can change to something like http://mysite.com/myApp/#page=5 without reloading the page. My problem is the following sequence: A user bookmarks the first URL. The user manipulates the appl...

How do I make Ajax calls at intervals without overlap?

I'm looking to setup a web page that samples data via AJAX calls from an embedded web-server. How would I set up the code so that one request doesn't overlap another? I should mention I have very little JavaScript experience and also a compelling reason not to use external libraries of any size bigger than maybe 10 or so kilobytes. ...

Changing RadCombobox Font Color when Disabled in ASP.NET

I am not exactly sure why this is not as easy as I expected. I need to change the font color of a disabled RadCombobox control . Any idea how I can do this please? .RadComboBoxcss { background-color: #808080; color:Blue; font-weight:bold; } ...

Form check with JS: select at least one checkbox and max 2 checkboxes

Hi, is there a way to validate a form through JS and check how many checkboxes are selected? I have a list with 15 checkboxes and I want that the user check exactly 2 checkboxes. ...

drawImage on canvas has weird aspect ratio in firefox and other problems

I am running firefox 3.5.6. I want to display an image on a canvas and draw a couple lines on it. It needs to display properly in firefox and internet explorer (using excanvas). Here is what I am getting: The top image is what I see in IE8, the bottom is what I see in firefox. IE seems to be a bit messed up as far as the canvas is...

Does jQuery handle events without setting the normal event handlers?

With a div on an HTML page, I used jQuery to add a click event handler: $(document).ready(function(){ $("div").click(function() { alert("clicked!"); }); }); Then I used the Visual Studio 2008 (or IE8) debugger to step through the javascript/jquery. I expected to see a value in the debugger for: $(“div”)[0].onclick (...

"with" keyword in javascript

Possible Duplicate: Are there legitimate uses for JavaScripts with statement? I recently discovered that in javascript, one can do something like the following: with document{ write('foo'); body.scrollTop = x; } The down side of this is that each variable needs to be checked to see if it belongs to the document object...

Why isn't my cookie being set?

I am learning, please be kind if it is an obvious mistake. /*set cookie*/ function setCookie(name,value,days) { if (days) { var date = new Date(); date.setTime(date.getTime()+(days*24*60*60*1000)); var expires = "; expires="+date.toGMTString(); } else var expires = ""; document.cookie = name+"="+v...

How to get ID of Image in Image Map Mouse Over

Let's say you have two images that use the same image map. <img src="/test/image1.jpg" id="image1" useMap="map-name"> <img src="/test/image2.jpg" id="image2" useMap="map-name"> <map name="map-name"> <area shape="rect" coords="0,0,82,126" alt="Sun" onmouseover="testFunction();"/> <area shape="circle" coords="90,58,3" alt="Mercury" ...

How to set focus on fb:swf tags in Facebook app?

My code is as follows: <input id="input" type="text" onfocus="Focus('Input')" /> <input id="text" type="text" /> <fb:swf id="game" onfocus="Focus('Game')" swfsrc="http://ventoline.com/frozenbubble/preloaderbustamove.swf" width="640" height="480" /> <script type="text/javascript"> function Focus(msg){ new Dialog...

jQuery Show/Hide by class when multiple items contain the said class

Thanks in advance for helping me out (for those who have time and are willing). I've written this script: $(document).ready(function() { // hides the slickbox as soon as the DOM is ready // (a little sooner than page load) $('.foliobtn').hide(); $('.folionamedate').show(); // shows the slickbox on clicking the noted link ...

Delay start of jQuery rotators, one second apart from each other

I have three rotators on the front page and I'd like them to start 1 second after each other. $(document).ready(function(){ $('#rot_top').cycle({ speed: 500, timeout: 2000 }); $('#rot_mid').cycle({ speed: 500, timeout: 2000 }); $('#rot_btm').cycle({ speed: 500, timeout: 2000 }); }); after the initial start - th...

importance of function wrappers in javascript

Can someone explain to me the importance of using function wrappers (ie: when assigning onclick functionality)? I know I should, but I don't fully understand why... Example: It's my understanding that this: $(callingImg)[0].setAttribute("onclick", "function(){removeChildren(this);}"); is better than this: $(callingImg)[0].setAttribu...

Calling Javascript form a ASP.NET Button located inside of an Update Panel.

I am using JQuery to toggle the visibility of a in a webforms application. I am using an update panel to suppress the postback when my is clicked. What I would like to do when this is clicked is call the JQuery code that I use to toggle the once the postback has completed. What code(client-side or server-side) do I need to impleme...

Getting and setting form values client side with javascript, json and jquery

I am building out an ajax enabled UI using webforms in asp.net. I really want this interaction to be extremely light. What I would like to do is make a call to get the data and then bind it to my form client side. Here is my working example. <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD...

HTML customizing Select tag

I have this Code For example: <select > <option value="volvo">Volvo</option> <option value="saab">Saab</option> <option value="mercedes">Mercedes</option> <option value="audi">Audi</option> <option value="audi">Audi</option> <option value="audi">Audi</option><option value="audi">Audi</option><option value="audi">Audi</option><...

How to load remote javascript into a SpiderMonkey context?

I have a server which will be serving up javascript files, I need to grab it and execute some of it's functions using SpiderMonkey in python. How can I do this? ...

Microsoft JScript runtime error: 'Sys' is undefined

I have a page with the following code on it: <script type="text/javascript" language="javascript"> /// <reference name="MicrosoftAjax.js" /> Sys.WebForms.PageRequestManager.getInstance().add_endRequest(EndRequestHandler); function EndRequestHandler(sender, args) { ToggleTimeDiv(); } </script> When the pag...

comma delimit javascript/asp line

Hi, What is the correct way to comma delimit this line, I keep getting javascript errors: <a href="javascript:doSubmit(<%= pound & rs("AdvertiserID")%>, <%=rs("AdvertiserName")%>)"> Its Friday, what can I say... The <%=rs("AdvertiserName")%>) can have single quotes in it, such as Dillard's and needs to be delimited, how would I add ...