javascript

registering a javascript file from a master page

Hi. Is there any reason why registering a javascript file from the head tags of an ASP.NET master page wouldn't work? For example, I have the following (plus many other) file referece: <script type="text/javascript" src="/js/jquery/jquery-1.4.2.min.js"></script> but jquery (and every other JS reference) doesn't work when the page lo...

How to get parent iframe element from inner page without knowing id?

Let's image that I have something like this: <html> ... <div> <iframe src="test.html" hash="r4d5f7"></iframe> <iframe src="test.html" hash="8f7x97"></iframe> <iframe src="test.html" hash="gg4v5e"></iframe> <iframe src="test.html" hash="e54f87"></iframe> </div> ... </html> test.html is empty page...

Choosing right technology (SVG vs Canvas)

I'm writing an app for shape manipulation, such that after creating simple shapes the user can create more complex ones by clipping the shapes against each other (i.e. combining two circles together into a figure 8 stored using a single path rather than a group, or performing intersection of two circles to create a "bite" mark), and am t...

checkboxes within the span, select deselect

I have the following html generated through my php code. What I want to do is that when I select the checkbox in span "row" then the checkboxes for "main_row" span in which "row" is contained in, should be cheked automatically. Also when I deselect the "main_row" checkbox, then all the contained in "row: checkboxes should be desel...

ASP.net server event handled client-side

I was wondering if anyone had an easy way to wire up javascript event handlers to events happening on the server-side. I have a long running process that includes a lot of steps, and would like the client to be continually updated with new information as the steps transition. Will this involve some sort of polling mechanism? ...

Authomatic data change announcement from website without local application

Hello, I have a very interesting question (at least in my opinion). There is a website using PHP/Javascript/MySQL and users of the website want to get announcement of some data changes, like Yahoo Messenger shows you that you've got new emails, but without writing an application. Is it possible to make a feature for the website to make...

How to do an action only when there is no default in Javascript / jQuery ?

I'm asked that a click anywhere in a div does a specific action (say collapse it) unless the click was on a link, a button, etc... Basically, I'd like the reverse of event.preventDefault(). Is there a good and easy way to do this? I'm looking for a generic solution here; I would like to not assume much about the content of the div. M...

checkboxes code

I have this code that will check the top level checkbox if the checkboxes underneath it are selected. What I also want to do is to unselect the top level check box, if there are no checkboxes selected underneath it. How can I modify this. Thanks if(this.parentElement == pg.thePart) { var terminate = false; v...

How can I add a simple link to a variable using openlayers / cloudmade?

Here's the code I've got; <script type="text/javascript" src="http://tile.cloudmade.com/wml/latest/web-maps-lite.js"&gt;&lt;/script&gt; <script type="text/javascript"> var cloudmade = new CM.Tiles.CloudMade.Web({key: '1b67988f99f947e3bd06fbcf924aeda1', styleId:19933}); var map = new CM.Map('mapa', cloudmade); map.setCen...

Is there any shared state between iPhone apps and mobile safari?

I have a website and a native iphone app. The app registers a custom protocol. I'd like the site to automatically redirect to the protocol when appropriate, but only if the user has the app installed (to avoid an annoying dialog). That means I need to write some state from the app that I can read in mobile safari to mark the app as insta...

IF IE neglect/hide div

Hello, I have page like this <html> <head> <div id="container"> Hello, this is NON-IE content. </div> </head> </html> What I want is to Stop Internet Explorer [ IE ] from loading OR Neglecting <div id="container"> & allow all other browsers to load It. Don't want to use <!--[if IE 7]>. Looking for Javascript to work with. How Ca...

How can I remove the caret(^) from a string using a RegExp in Javascript?

For some reason, I can't seem to find a good answer for this one. I have been trying to escape out the caret (\^), and to use the hex, octal, and other codes for the character using \xdd, \dddd, etc... But my replace regexp won't replace the caret (^) with anything. It seems to simply break the expression. Here is the code I am using:...

JQuery selector multi-class objects

Hey all, I've been trying to get a series of objects to appear that have multiple classes associated with them <div class="Foo Bar"> Content </div> <script> alert($('.Foo').length); </script> The selector above is returning 0. This is unfortunately one of those questions that is completely impossible to ask to google (at leas...

Openin MSN Messenger windows through Javascript

Hello, I was wondering how to create a launch script to open Windows Live Messenger window. I tried several and also using LaunchIMUI (for windows messenger) but with no luck. I have used some to open Skype for example, but couldnt find one for messenger. Does anybody know somehow to do it? Thanks! ...

Unexpected javascript behaviour issue

I wrote this validation method but am having issues with it. function validate_password(pwd) { var score = 0; // Min length is 8 if (pwd.length<8) return false; // Is lower present? if (/[a-z]/g.test(pwd)) { console.log('a-z test on "'+pwd+'":' + /[a-z]+/g.test(pwd)); score++; } ...

How to create a file of constants in Javascript?

Hi, Is there a way to create a file of constants in JavaScript, which I can reference and then use? What I am looking for is something like this: Constants.js: var Phones = { Nokia: 1, Samsung: 2 } Then, in another JavaScript file JS2.js access those values: JS2.js: alert(Phones.Nokia); And then, in ...

jQuery Autocomplete, enter triggers another binding

Hi, I am using jqGrid and have inline editing with a textfield using jQuery autocomplete. My problem is that autocomplete binds my enter key (to the input element) to select an item in the autocompletion list of suggestions. This is all nice, however, my jqGrid has also bound my enter key to the table row, saving the row and exiting edit...

Running .exe from Javascript

Hi , I am trying to run a .exe file from Javascript .This is what I have- var oShell = new ActiveXObject("Shell.Application"); var commandtoRun = "C:\Documents and Settings\User\Desktop\ABCD.exe"; oShell.ShellExecute(commandtoRun,"","","open","1"); If i have only the first 2 lines code it seems to work fine (it asked me d...

How to print datatable all values ?

How to print the datatable values using jsp ? i need to print(hardcopy) of all datatable values in jsp. I used the javascript function for open printer dialog: function callsubmit(){ window.print(); window.opener.document.location = window.opener.document.location.href; window.close(); } But this option pringing the whole page....

jquery one liner for finding and highlighting rows where contents of 1st cell is gte 2nd cell

$('tr').find(need help here).parent().css('backgroundColor', '#fcc'); would like to perform inequality check of two dates (both strings) in the 'need help here' section of the above snippet. Thanks ...