javascript

In Javascript event handling, why "return false" or "event.preventDefault()" and "stopping the event flow" will make a difference?

It is said that when we handle a "click event", returning false or calling event.preventDefault() makes a difference, in which the difference is that preventDefault will only prevent the default event action to occur, i.e. a page redirect on a link click, a form submission, etc. and return false will also stop the event fl...

Trigger events from Firefox browser extension?

Hello, I want to trigger events from a firefox extension, specifically click events. I've tried jQuery's .click() as well as the whole: var evt = document.createEvent("HTMLEvents"); evt.initEvent("click", true, false ); toClick[0].dispatchEvent(evt); This is not working for me, and I was wondering if this is even possible? (to tr...

replace commas with spaces from json array

I have a looping function creating: <li id="id1" name="Tag1,Tag2,Tag3"> <li id="id2" name="Tag1,Tag2,Tag3"> $.each(data.posts, function(i, post){ $('<li >', {id: this.id , name: post.tags}) }); How do I replace the commas between the tags with spaces. Also is there a way I can send the tags to a "class" attribute instead ...

YouTube javascript page drop down

hi everyone, does anyone know how to create a code so that after a user logs onto a site for say like 10 seconds, a screen drop down. on the screen (new page layer) is a youtube embedded video. ...

Tool used to retrieve code metrics in xUnit Test Patterns?

I'm reading xUnit Test Patterns by Gerard Meszaros. On one of the pages he refers to some software metrics: While the need to wrap lines to keep them at 65 characters makes this code look even longer than it really is, it is still unnecessarily long. It contains 25 executable statements including initialized declarations...

regular expression repeating subexpression

I have the following text <pattern name="pattern1"/> <success>success case 1</success> <failed> failure 1</failed> <failed> failure 2</failed> <unknown> unknown </unknown> <pattern name="pattern4"/> <pattern name="pattern5"/> <success>success case 3</success> <pattern name="pattern2"/> <success>success case 2</success> ...

Posting null values via AJAX

Using the jQuery $.post function, if you send a null value, it arrives at the server side as "null". Example: Javascript: $.post('test.php', { foo : null }); PHP: var_dump($_POST['foo']); // string(4) "null" I understand why this is so, but was wondering the best way to work around the limitation? Should you: Loop through all th...

Cross-domain REST proxy with Javascript, HTML5

I'm writing a service (say, service.com) that provides a REST API to external apps running inside of IFrames. (These apps are hosted from domains outside the service.com). I'm planning a javascript client library for the apps to make pure-javascript requests to the service.com REST API -- basically using postMessage and some ad-hoc en...

I am getting error as "operation aborted, Internet explorer can't open the page"

I have created a shopping cart site, and i have got two complains for the same issue, but i am not able to track the main problem... They say they get the message "operation aborted, Internet explorer can't open the page" whenever they navigate to any page, and clicking "OK" displays "page cannot be displayed". Could someone help me ou...

drop down list in a text box

i want to show the details of a student who entered into the library in a text box like drop down when the mouse is placed over it ...

changing validation group of button with javascript on client side

hi, In a form I have multiple group of controls which are grouped using validation group property. I want to assign validation group to asp.Button dynamically on client side using javascript on the base of item selected in drop down list. Here is JavaScript which I am using, but it is not working. It shows validation group undefined bu...

Set data structure of Java in javascript/jQuery

Is there any way to create Set data structure(Unique Collections) like java in javascript? ...

Visual Studio 2010 and javascript debugging in external javascript files (embedded and minified).

Hi, The asp.net web application I'm working on is written in asp.net 3.5, the web app solution is upgraded from VS 2008 (don't know if that matter). The solution had javascript in the aspx files before I moved the javascript to external files. Now what I have done is to set all the javascript files to be embedded resource (except the ...

How to force delete cookies even if one window is still open?

Apparently in IE8, there is this option 'Preserve Favorites website data', even if I uncheck it the browser will still keep the cookies until the last window is closed. Problem scenario. say I logged in to somesite.com, then without logging out, I closed the window, but there was still another IE8 window open. In this case IE8 will keep...

how to find textbox value from asp.net to javascript

i have a textbox in asp.net form.... if i entered numbers not like 7 or 8 or 9, then script function should be araised with alert message.... how to achieve this.... that 7 or 8 or 9 are first digits in my texbox... ...

Unable to show a division tag using JS

Consider, I've got this code in PHP <?php if($count==0) { ?> <script> show_my_div(); </script> <?php } ?> the show_my_div() is supposed to show a division tag. But It doesn't work. Please help. ...

Push SVG String into Dom?

I have a javascript variable that basically looks like this: my_svg_image = '<circle cx="227.58331298828125" cy="102" r="3" style="fill:black;stroke-width:0" />'; It was loaded from my database. Is there a way I can parse that string and add it to the DOM with Javascript? I have svgweb set up, but don't see how I can get it to parse...

After what point a JavaScript library is considered as a FrameWork?

Hi, I am kind of confused with the definitions. Can you please define the minimum "must haves" of a JavaScript library so that it can be considered as a software framework? thanks ...

jQuery1.4.2 $.ajax crashes IE6/7

Hello there! I'm having a really hard time debugging one of our latest reported bugs. The problem occurs "randomly", not on every page load, sometimes I can "click" around for a minute or two before IE6/7 crashes. By crash I mean that the IE-window shuts down and I get the option to send the crash info to Microsoft. In FF, Chrome, Safa...

JavaScript Exception/Error Handling Not Working

This might be a little hard to follow. I've got a function inside an object: f_openFRHandler: function(input) { console.debug('f_openFRHandler'); try{ //throw 'foo'; DragDrop.FileChanged(input); //foxyface.window.close(); } catch(e){ ...