javascript

How to execute javascript once an update panel refreshes (Can't get Sys.WebForms.PageRequestManager.getInstance().add_endRequest(); to work)

I'm trying to run javascript once an update panel has refreshed. I've read a few places that you can use code similar to this: function codeToRun() { //Code Here } Sys.WebForms.PageRequestManager.getInstance().add_endRequest(codeToRun); But it doesn't seem to be working... any ideas? I've tried putting the code inside the Content...

Javascript: Enter for submit

Hello this is what i have in the head of my file: function entsub(event) { if (event && event.which == 13) write1(); else return true; } and in the body, my form is: <form id="writeform" name="writeform"> Message: <br /> <textarea name="message" rows="3" id...

Wrapping For in loops with if statements in Javascript -- looping over arrays

JSLint keeps complaining about things like this var myArray = [1, 2, 3]; for (var value in myArray) { // BLAH } Saying that I should wrap it in an if statement. I realize you need to wrap it if you are looping over an object's properties, but here what should I put in the if statement to do the correct filtering. Additionally when...

Open an accordian panel with a function

ok here is the full code with the spelling corrections and everything. I am still getting an error. code for parent is : $("#leftNav").accordion({autoHeight: true}); <div id="leftNav"> <h3><a href="#">Client</a></h3> <div> static text </div> <h3><a href="#">Account Summary</a></h3> <div> static text </div> <h3><...

Insert contents into innerHTML without clearing what's already inside

I'm trying to create a post button that inserts the latest posts into a div, without clearing everything that is inside. My current code inserts the new divider, but clears everything inside it, so i end up with just the last post. Does anyone know how to fix it? Thanks The code is: var xmlHttp function submitNews() { xmlHttp=GetX...

Javascript validate X number of fields in an HTML form

I have a form, that has about 10 text entries (user, address, email etc;) and about 50+ entries that are quantity entries (users select 2x of this item, 5x of this item). Now I inherited this form from someone else (now its my duty to keep it up to date, when the customer requests it). I don't want to re-write it all, but I would like ...

How to suppress the browser's "authentication required" dialog when doing an ajax call that requires authentication?

My users enter a username and password for a third party service. I do an ajax call to that service to authenticate them. The issue is that if they enter the wrong username and password the browser (at least firefox) will display an "authentication required" dialog. If they then enter the correct username and password in that dialog, my ...

image src doesnt change after upload

Hi all i am making an upload with Ajaxupload plugin and i am using this function in OnComplete event of ajaxupload; function degis(){ var a = "<?php echo $id; ?>"; document.getElementById("imga").src = "../artwork/"+a+"/logo.jpg?dummy=371662"; document.getElementById("imga").style.width = "500px"; document.getElementById("imga").style....

ASP.NET Gridview: How can we find which column was selected in gridview ...

I have extended the Gridview making it Clickable (i.e. when ever we click on any row it is selected and a detail view is shown according to the row selected). I then added Selecting / Deselecting all the CheckBoxes in that GridView with the help of javascript. The problem now is that the page is being postbacked every time i click check...

Can dojo Access the function assosiated with a HTML elements Event?

I would like to over ride the function associated with an elements onclick event when the screen is in "edit" mode. Then when done editing put the original function back. So, originally I have the following: <script type="text/javascript"> var showAddNewForum = function(){ dojo.byId("NewForum").className = dojo.byId("NewForum...

How can I keep a music player in the page footer that doesn't reload when I click a link to a subpage?

I have been trying to solve this problem for a while now and have looked on numerous forums to find a solution. Here is my setup. Any help would be greatly appreciated! I currently have a index page that loads a JavaScript header and footer above and below my "content" section. I also have a list of navigation links inside of the head...

javascript/jQuery setTimeout

i have this code: $('.myButton').live('click',function(){ var checkTextValue = setTimeout(function() { var textVal = $('p').text(); if (textVal == 'expectedValue'){ alert('done'); } else { setTimeout(arguments.callee, 10); } },10); }); when the button is clicked for the first time it works just ...

Not adding a namespace when using xml.setNamespace()

Whenever I call xml.setNamespace(ns), the namespace of the element is set to ns, but ns is also added as another namespace with it's own prefix to the element. I would like to know how to stop the latter from happening (I'm okay with modifying XML.prototype.function::setNamespace) without defining @xmlns as I can't use E4X syntax. Altern...

Is there a good javascript plugin for visual studio?

Hi, I think that Visual Studio's biggest let down is the Javascript editor. I have been told to use Aptana as an editor for my javascript files, but I would prefer to stick with visual studio if possible. I have read other similar plugin posts, but none focus specifically on Javascript. VS2010 may offer some improvements, but will th...

Detect Image Load Cancelation in Javascript

I'm currently working on a page that loads several images sequentially using setTimeout and onLoad. Basically when an image finishes loading, onLoad is triggered, which starts another image loading via a setTimeout call. Unfortunately, if an image load is interrupted for some reason, such as a subsequent ajax call, onload is never call...

Algorithm to sort parents before children

I'm writing a drawing application that includes shapes that can have children. When I need to redraw the canvas, I would like to sort the shapes to draw so that the parents appear before their children. That way, a parent shape won't be drawn on top of a child shape. Here is the relevant function (written in JavaScript). Variables prefix...

What context does the Javascript for XUL execute in?

Is it possible for the javascript you write for a XUL component to interact with the javascript defined in a webpage? Eg, if a particular webpage has a dooSomethingNeat() function, can I have a button defined in a XUL overlay execute that function, or does it live in another namespace? Put another way: if I'm looking to enhance the fun...

what is jsdisplay?

Can someone suggest a tutorial. I am trying to figure out how to configure google checkout gadget and I can't make the product image bigger. I think the problem is with the jsdisplay. Not sure but would at least like to rule it out. Thanks ...

Persistent display (hide/show) for dynamically created DOM elements?

I have a set of DOM elements that I want to show only when a controlling checkbox is checked by the user. All of these items have a common class and are initially hidden: .spec { display:none; } In the click handler of the checkbox, I originally had the following, which worked fine for existing elements. However, the tables are dyn...

Removing ASP.NET validators for controls that are no longer on the page.

I have a page that loads different controls into a placeholder via a ComponentArt Callback based on the user's action (clicking a link). I am running to this scenario: Action 1 loads a control with ASP.NET validators into the placeholder. Action 2 loads a different control with no validators (the first control is replaced and no longe...