javascript

How to detect quirks mode in Safari 3.0.x?

Safari 3.0.x doesn't support the document.compatMode property to detect whether the document is rendered in standards or in quirks mode. Safari 3.1 and newer do support it. How do I detect the document mode in Safari 3.0.x if document.compatMode is not available? ...

how to split a string in javascript

how to split a string in javascript? example str = "this is part 1 one wall this is part 2 " now I want to split the str in 2 parts separated by word wall so I want output to be: st1 ="this is part 1 " st2 ="this is part 2 " ...

Example of a circular reference in Javascript?

Hi, I was wondering if anyone has a good, working example of a circular reference in javascript? I know this is incredibly easy to do with closures, but have had a hard time wrapping my brain around this. An example that I can dissect in Firebug would be most appreciated. Thanks ...

Make enter key behave like tab key in Javascript

So far i have this being called on keypress. function chkenter() { e = event.keyCode; if (e == 13) { event.keyCode = 9; return false; } } but even though i set the keycode to 9 it doesn't tab over to the next control. How can i accomplish this? I'm working in Asp Classic. What I ultimately want is for the focus to m...

Javascript Spreadsheet engine / library ? mapped to form fields

I'm looking into some sort of Javascript spreadsheet engine, that would allow me to define complex calculations in some sort of standard spreadsheet format (Excel, WKS or even some text based proprietary format) and then allow me to read it from this formatted file (on the server) into the Javascript spreadsheet engine and map it to par...

can p3p be used to allow access to iframe dom in IE?

When creating iFrame dynamically (javascript) on IE and trying to access its document, access denied error is issued (because its source is not on the same domain as the containing html). I think I read somewhere that 3p3 header can lower this restriction (usually it is used for 3rd party cookies). Can anyone explain how to do it for dy...

POSTing a complex JSON object using Prototype

I'm using Prototype 1.6.1 to create an application under IIS, using ASP and Python. The python is generating a complex JSON object. I want to pass this object to another page via an AJAX request, but the Prototype documentation is a little too cunning for me. Can someone show me an example of how to create an Prototype AJAX.Request th...

JavaScript/jQuery callback to server with no supporting executable backend

A fellow techie asked me today if jQuery (or JavaScript in general) could ping back to its source of origin and get information about the filesystem without the use of executable code. My knee jerk answer was that there would be no way that IIS would allow this to happen without the use of AJAX, ASP.NET or some other executable technolo...

Inline Javascript in rails partials

When writing partials in Rails I sometimes feel the urge to use inline Javascript for basic DOM manipulation functions that will only ever be relevant to the HTML in the partial. Should I feel bad about this? My thoughts are that separating out 20 lines of JS into a separate file won't save more than a few KB of bandwidth (in fact it'll...

JQuery and C# ASP.NET Form and File Validation

I am confused about the best way to intertwine jquery/javascript with C#. I am supposed to put a javascript confirm popup into a file upload form. However the confirm only pops up if certain criteria is not met. There are 4 elements on the form that are of importance. clientId_txt - An input text field of client's ID program_radi...

How to get a timestamp older than 1901

I'm trying to find to accurately count the number of seconds since Jan 1, 1850 to the present in a couple of languages (JavaScript, C++, and Python [don't even ask, I stopped asking these questions long ago]). Problem is the platforms store timestamps as 32-bit signed integers, so I can't get a timestamp for dates older than 1901 to eas...

Intercept Specific Calls in Javascript

My site has a trusted third party Javascript library. At runtime, the library will append various other blocks of Javascript to the page. I had an issue where one of the blocks of Javascript really messed up my page in IE. The problem is that the script was calling "document.body.appendChild" before the DOM was loaded. IE really doesn...

Regex Javascript 0-9a-zA-Z plus whitespace, commas etc

Hiya, Can anyone help me with this regex? I need something which will ALLOW: 0-9 a-z A-Z spaces hyphens apostrophes But disallow all other special characters. I've got this, but it's not working: "regex":"/^[0-9a-zA-Z/ /-'_]+$/", Thanks for any help! ...

Understanding AJAX.

Having been primarily a server-side programmer(ASP.NET WebForms) I'm trying to get my mind wrapped around AJAX outside of the "catch-all" approach of using UpdatePanels in the Microsoft AJAX controls. My question has a couple parts: Is JavaScript the only option for client-side scripting that will support server-side communication? I...

Adding HTML in a dojo Tree label

I have a dojo dijit.Tree, and I want to be able to put some html in the labels. To do this, I created an function called getCustomLabel and assigned it to the tree getLabel attribute: tree = new dijit.Tree({ model: aMOdel, showRoot: false, getLabel: getCustomLabel }); function...

YUI MenuBar, adding content to a drop down menu

Hello everyone, this is my first time posting on this site. I have a question regarding YUI menubar. It's fairly easy to set it up, however, I am trying to do something different with YUI menubar. I am trying to add content inside the drop down menu. What I mean by this is, having the drop down menu open up to a form, and not necessari...

Grab/input php variable in javascript?

Hello, I am trying to dynamically get a php variable and place them into my javascript variable as seen below: var site_url = "getsite.php?name=SiteName&link=linkURL"; That above script is what I have now and it is harcoded(SiteName,linkURL). I want to change 'SiteName' and 'linkURL' to display whatever the PHP variable is on another...

What is a javascript regular expression for matching time in military (24 hour) format?

I would like a javascript regular expression that will match time using the 24 hour clock, where the time is given with or without the colon. For example, I would like to match time in the following formats: "0800", "23:45", "2345" but that would not match invalid times such as "34:68" or "5672" ...

I'm losing data when manipulating xml with jQuery!

Related Question: http://stackoverflow.com/questions/1489402/manipulating-a-variable-containing-xml-with-jquery I have a jsp which returns an xhtml document that looks something like this: <root> <p id = "myId">Text text text <img id = "myImgId" /></p> </root> Now, when I pull this data into a variable via an ajax call through jQu...

How does Javascript's sort() work?

How does the following code sort this array to be in numerical order? var array=[25, 8, 7, 41] array.sort(function(a,b) { return a - b}) I know that if the result of the computation is... Less than 0: "a" is sorted to be a lower index than "b". Zero: "a" and "b" are considered equal, and no sorting is performed. Greater th...