What is the purpose of a self executing function in javascript?
In javascript, when would you want to use this: (function(){ //Bunch of code... })(); over this: //Bunch of code... ...
In javascript, when would you want to use this: (function(){ //Bunch of code... })(); over this: //Bunch of code... ...
Hello again. I am using a javascript called 'Facelift 1.2' in one of my websites and while the script works in Safari 3, 4b and Opera, OmniWeb and Firefox it does not in any IE version. But even in the working browser i get the following error I cannot decipher. Maybe in due time—with more experience in things Javascript—I will be able ...
I've seen a few JavaScript image rotators that use either the HTML5 canvas element or an AJAX call to a server-side script, but is it possible to do it without using those methods? Internet Explorer doesn't support canvas (I'm aware of excanvas, but I'd like to do without if possible) and I'm not sure if AJAX will be fluid enough. If the...
Does Firebug have something built-in to disable all javascript for a site/page? ...
Duplicate: Javascript Variable Variables How can I create variable variable names in Javascript? EDIT: I've clarified what I'm trying to accomplish here. ...
I am using the excellent jQuery MultiSelect plugin as advertised here: http://abeautifulsite.net/notebook/62 The problem I have is that I would like to submit the form when the values have changed. Having all sorts of trouble getting this one working, does anyone have insight into how to achieve this? Also open to alternative jQuery p...
Instead of having the typical disks with labels to the right, I want the options to be presented as clickable buttons. The selected option should appear to be pushed or pressed in. I want to do this in HTML, but an example of this are the top left buttons in the program Audacity where you select the cursor/tool mode. What's the best w...
Hi, I work with WPF WebBrowser control which different from WinForms and many recommendations from this excellent web site simply does not work in WPF. I try to find solution how I can overwrite particular javascript function btnSubmit_onclick() on a web page. This function generates confirm dialog (like "Are you sure?") which I want t...
What I want is a hyperlink More when clicked on runs some javascript function and also changes to a hyperlink Less. Heres what I have which doesnt work. It runs the ajaxpage function fine but not moreToLess. I think its my use of " and ' in the javascript. <script type="text/javascript"> function moreToLess(){ document.getElementById('...
I cooked up a pattern to create and extend html elements using their prototype. This works like a charm in non-ie browsers. Example code can be found @jsbin (see page source) The advantage of this pattern should be speed (the methods are in the elements prototype chain, so they are referenced once). You guessed right: IE no go. In IE < ...
Hi I have tested this on Firefox, Opera and Seamonkey. It works fine. When it comes to Internet Explorer 7. It works but upto a certain point. I am making an AJAX call to a PHP script every few seconds. In IE7 it makes the first AJAX call and it retrieves the data but it doesn't do it again ever. Even though i have a setTimeout function...
I have a set of global counter variables in Javascript: var counter_0 = 0; var counter_1 = 0; var counter_2 = 0; etc I then have a Javascript function that accepts an 'index' number that maps to those global counters. Inside this function, I need to read and write to those global counters using the 'index' value passed to the functio...
When flash has keyboard focus, CTRL+T (new tab) and CTRL+N (new window) are intercepted by flash. Is there a way to pass these events through to the browser so that they work (opening new tab, opening new browser) OR is there a javascript command for these actions? ...
I have a GridView that lists a bunch of items and one of the columns has a link that displays a modal (AjaxToolkit ModalPopupExtender). Let's call that link "Show". In that modal, I have a asp:button for saving the data entered in that modal. Let's call that button "Save" So when the user clicks on a "Show" link in a certain row, I'd ...
I am looking to write a javascript function that will fire when a user submits a form, however I do not have edit access to the submit button so that I can add the onsubmit function. I am able to add a <script> tag, so if I can detect the submit, then I can execute my code. Anyone know how to do this? ...
So I know what this does: $(document).ready(function(){ // Your code here... }); Now I have seen people doing this lately: <script type="text/javascript"> $(function(){ // Your code here... }); </script> Are these two ways of doing the same thing? I see an anonymous function being declared inside a jquery selector her...
I find this excellent code, posted by aemkei as answers to this questions: How do you dynamically load a javascript file? (Think C’s #include) Use javascript to inject script references as needed? You may write dynamic script tags (using Prototype): new Element("script", {src: "myBigCodeLibrary.js", type: "text/javascript"}); ...
Ok. here's the scenario: function DataFeed(){ function PopulateData() { $('div#example').load('http://www.example.com', fxnCallBack); }; function fxnCallBack() { PopulateData(); } this.activator = function() { PopulateData(); } }; var example_obj = new DataFeed; example_obj.activator(); In the above co...
I'm having a hard time picking up how to grab the dimensions of an element with jQuery. Here is my sample code: $(document).ready(function() { var width = $("#image_1").width(); var height = $("#image_1").height(); document.write(width); document.write(height); }); Now of course I have an image wi...
why does this work.. <script type="text/javascript"> <!-- function myAlert(){ alert('magic!!!'); } if(document.addEventListener){ myForm.addEventListener('submit',myAlert,false); }else{ myForm.attachEvent('onsubmit',myAlert); } // --> </script> but not this ???? <script type="text/javascript"> <!-- function ...