javascript

Calling server event of a button in ASP.NET from Javascript

I have a button, I need to display a pop-up in javascript. So on its client click I call a javascript function which does that. if user clicks "yes", I need to do a post back and call buttons server side click event, here is what I am doing inside the javascript function __doPostBack(deleteLinkButton, 'Click'); ' Where deleteLinkBut...

Formatting Tables to not look like tables / JS Sorting without tables?

I'm designing an interface to display sets of data. I'm interested in organizing the information in a customized format using DIVs and SPANs to identify where specific data will be (not in the typical row-by-row format tables provide) but still having the flexibility of sorting and organizing the data that most JS libraries provide for t...

Javascript automatic getter/setters (John Resig Book)

Hi, I'm reading "Pro Javascript Techniques" from John Resig, and I'm confused with an example. This is the code: // Create a new user object that accepts an object of properties function User( properties ) { // Iterate through the properties of the object, and make sure // that it's properly scoped (as discussed previously) for ( ...

Need a WYSIWYG PHP / Javascript IDE - replacement for Dreamweaver

I'm looking for a replacement website application development IDE. Ideally it will run on both Linux (Ubuntu) and Windows. I'm typically developing small to medium sized web applications of some richness and complexity - by way of example I'm currently handling a site for a local council which manages their waste collection and reproce...

jsonp request not working in firefox

I am trying a straightforward remote json call with jquery. I am trying to use the reddit api. http://api.reddit.com. This returns a valid json object. If I call a local file (which is what is returned from the website saved to my local disk) things work fine. $(document).ready(function() { $.getJSON("js/reddit.json", function (js...

Javascript: Event does not fire unless element appended to document.body

Hi All, I dynamically create an element (div) in javascript, on which i register an event listener: var tooltip = document.createElement('div'); tooltip.onclick = function() { alert('hello'); } Now, if I attach this element to the document body: document.body.appendChild(tooltip); all is well and the event is captured. However (fo...

Efficient Javascript String Replacement

Hey there, I've got a block of HTML that I'm going to be using repeatedly (at various times during a users visit, not at once). I think that the best way to accomplish this is to create an HTML div, hide it, and when needed take its innerHTML and do a replace() on several keywords. As an example HTML block... <div id='sample'> <h4>%...

What anti-patterns exist for JavaScript?

I find that what not to do is a harder lesson to learn than what should be done. From my experience, what separates an expert from an intermediate is the ability to select from among various seemingly equivalent ways of doing the same thing. So, when it comes to JavaScript what kinds of things should you not do and why? I'm able to f...

flvFPW1() - What does it do?

Hello! I've been tasked with rewriting the Javascript engine currently powering my customer's internal website. While reviewing the code I've come across this function flvFPW1 which I do not recognize, nor can I decipher the code(my Javascript knowledge is modest at best). A Google search gives me a few hits, but most if not all page hi...

Web XML Editor - with XML syntax highlighting

I am trying to find a web-based XML Editor with at least syntax highlighting. Something simple in Javascript or Flash would be nice. The more lightweight, the better it would be. ...

What is the best way to limit the amount of text that can be entered into a 'textarea'?

What is the best way to limit the amount of text that a user can enter into a 'textarea' field on a web page? The application in question is ASP .NET, but a platform agnostic answer is preferred. I understand that some amount of javascript is likely needed to get this done as I do not wish to actually perform the 'post' with that amount...

Finding DOM node index

I want find the index of a given DOM node. It's like the inverse of doing document.getElementById('id_of_element').childNodes[K] I want to instead extract the value of K given that I already have the reference to the child node and the parent node. How do I do this? ...

Swap Image from jpg to swf

Is there a javascript function to swap a still image(jpg) to a movie(swf)? If there is is there a disjointed swap image path? ...

.net Accordian Causing me Problems

I had a bunch of controls that I displayed, hid, enabled and disabled based on actions in the web page. Everything worked until i put them into an accordian. Now I can't get the Javascript to be able to update their state. I have a small example this is the Javascript <script type="text/javascript"> var ctrl = document.getElement...

Copying an entire document into an iframe with javascript

It sounds wonky, but this is what I'm trying to do with javascript (this is all triggered by an event handler): Save the contents of a page (preferably the whole document or at least documentElement object) into a variable. Create an iframe and insert it into the body. Replace the document of the iframe with the saved document (so that...

How do I escape content that might include a quotation mark?

I'm wanting to capture my search terms and pass them to a JavaScript variable, but I don't know how to handle quotes that might come through. Here's what I have currently: var searchTerms = "<!--#echo var="terms"-->"; var pattern = / /g; newSearchTerms = searchTerms.replace(/[^a-zA-Z 0-9]+/g,''); var searchStr=newSearchTerms.replace(pa...

Free Syntax Highlighting editor control in JavaScript

I need to let user to edit some code in my web-app. I want to highlight the syntax as he types. Note: I need code to be highlighted on the fly, right inside editor control. I do not need offline source highlighters. Is there some free JavaScript-based code editor which does the job? I'll need to highlight Lua syntax, but I can add it ...

VS 2008 JavaScript Intellisense Woes

I have a JavaScript class that I have made and put it into its own .js file. When I reference the the file from a web page and create an instance of that class there is no intellisense telling me the methods\variables available, it just show constructor as the only method. But when I copy the class and past it straight into the web page ...

Determine which ASP.NET button was clicked using Javascript

What is the best way to determine which ASP.NET button was clicked on a single page using JavaScript? ...

How common is it for Javascript to be disabled

I see lots of JavaScript advice centered around making sure your web application still works when JavaScript is disabled. But is that still an issue? What percentage of people do that? And are they are large enough group to actually care about? I'm being asked to create more interactive pages by my customers (a la AJAX and JQuery for m...