Tools to enforce a coding style for Javascript
I need to automatically check the style of javascript sources written by different people. Do you know of a good tool to do it? Integration with emacs would be a plus. Thank you in advance. ...
I need to automatically check the style of javascript sources written by different people. Do you know of a good tool to do it? Integration with emacs would be a plus. Thank you in advance. ...
I want to provide a piece of Javascript code that will work on any website where it is included, but it always needs to get more data (or even modify data) on the server where the Javascript is hosted. I know that there are security restrictions in place for obvious reasons. Consider index.html hosted on xyz.com containing the following...
I know innerHTML is supposedly evil, but I think it's the simplest way to change link text. For example: <a id="mylink" href="">click me</a> In JS you can change the text with: document.getElementById("mylink").innerHTML = new_text; And in Prototype/jQuery: $("mylink").innerHTML = new_text; works fine. Otherwise you have to rep...
I need to capture a web site and am looking for an appropriate library or program to do this. The website uses Java Script and pushes updates to the page and I need to capture these as well as the page itself. I am using curl to capture the page itself but I don't know how to capture the updates. Where given a choice I would use C++. Re...
In jQuery you can get the top position relative to the parent as a number, but you can not get the css top value as a number if it was set in px. Say I have the following: #elem{ position:relative; top:10px; } <div> Bla text bla this takes op vertical space.... <div id='elem'>bla</div> </div> $('#elem').position().top; //...
I want to have a datepicker where you can also just type basically I want to have the jQuery UI Datepicker and datejs in one. I want to type "tomorrow" and I want it to select the right day. I want to be able to type "saturday" and it actually getting the date right. ...
I like the Stack Overflow comment UI a great deal and I'm looking into implementing the same thing on my own website. I looked at the code and it looks like the main tool here is WMD, with the JQuery TextArea Resizer playing a supporting role. WMD converts Markdown into HTML on the client side. That's pretty nice because it helps out w...
I've been using John Resig's getStyle function from Pro JavaScript Techniques to get the style of elements: function getStyle(elem, name) { // J/S Pro Techniques p136 if (elem.style[name]) { return elem.style[name]; } else if (elem.currentStyle) { return elem.currentStyle[name]; } else if (document.de...
I'm trying to implement a comet style, long polling connection using an XMLHttpResponse object. The idea is to maintain an open connection to a server which sends data when it is available (faking push). As soon as the XHR object completes, I need to spawn a new one to wait for any fresh data. Below is a snippet of code which outlines a...
I have a funciton that I am currently using to show a hidden div.a_type How can I modify this code so that instead of fading in the hidden div, I can add the new div to the DOM jQuery(function(){ // Add Answer jQuery(".add_answer").click(function(){ if(count >= "4"){ alert('Only 4 Answers Allowed'); }else{...
While researching the issue of JSON vs XML, I came across this question. Now one of the reasons to prefer JSON was listed as the ease of conversion in Javascript, namely with the eval(). Now this immediately struck me as potentially problematic from a security perspective. So I started doing some research into the security aspects of ...
What are your favorite JavaScript debugging tools besides Firebug? Thanks, Eric Duplicate: http://stackoverflow.com/questions/103155/javascript-debugger ...
Hi, I don't think this can be done "cleanly", but I'll ask anyway. I have a system which needs to get a JSON resource via a REST GET call in order to initialize. At the moment the system waits until the onLoad event and fires an ajax request to retrieve the resource, which I don't think is the best way to do it, as the resource is need...
I've finally got the datepicker to work on my MVC demo site and also the dialog. I still have a few issues: the dialog doesn't show in IE7 so when I click a link where a confirm dialog is supposed to appear it just removes the row without showing the dialog. It works great in Firefox3 and Safari. Please try for yourself on my Demo sit...
Using preferably JScript, but VBscript will also do, how does one walk a DLL obtaining the properties and their attributes contained therein? Why? Because it would be good to ascertain the attributes of certain objects such as their datatypes at runtime rather than having to hard-code them before hand. An example of their use would be to...
I'm getting this error after trying to "appendChild" to an element that was just created (in for loop). What does this error mean? I suppose it's not possible to append sth. to an element that doesn't really exist in DOM. How do I fix it? "innerHTML" works, but I don't think it's really clean and proper way to do it. ...
[System.Web.Services.WebMethod] [System.Web.Script.Services.ScriptMethod] public string[] GetRowsByFilter(string prefixText, int count) //public static List<string> GetRowsByFilter(string prefixText) { DataTable table = ds.Tables[0]; string filter = "stShortName LIKE '" + prefixText.Replace("'", "''") ...
There has to be something utterly simple I'm overlooking here, but for the life of me I can't get a JavaScript file to include properly from my master page. My declaration in the <head> element looks normal enough: <head runat="server"> <title>Untitled Page</title> <script type="text/javascript" src="/_private/scripts/jquery-1....
Is it possible to detect if a page is opened in 2 different browsers? I have built an small app, that stores some data in $_SESSION, and the problem is that when multiple tabs gets opened, the session vars gets overwritten (search filters in a search form) and so the tabs may display the same results for apparently different searches. ...
Hi, I am trying to use jCarousel plugin for jQuery in order to provide my website users with scrollable (horizontal) content. The content I am mentioning is basically user defined <li> elements, styled so that they have a feel and look of a tab. so basically I am trying to achieve the same effect of the tabs in pageflakes.com. As you ma...