javascript

How do i translate this to "simpler" JavaScript?

Since i'm working with Titanium i realzed that its current JavaScript Interpreter doesn't accept specific coding-styles. So for for-loops and if-statements i have to have braces, even though i only want to span one line. Furthermore there is more i have to change if i want to use a Javascript Library like underscore.js. This is what Tit...

Code Profiling in the Windows Sidebar Environment

Does anyone know of a way I can code-profile my Windows Sidebar Gadget? I've played around with the code-profiling tool in IE8's "Developer Tools" and the code-profiling included in Visual Studio 2010, but I can't find a way to include the System.* API, which my gadget relies on (as it is standard in the Sidebar environment). The gadge...

Changing the cursor in asp.net

I want to change the cursor to an hourglass in my asp.net application to let my users know that the process is running. I searched for an answer and was advised to use javascript as follows. 1) Add this javascript function hourglass() { document.body.style.cursor = "wait"; } 2) then in my code in the page load event: btnImpor...

how can I restrict django ImageFieldFile to accept input only Image files from browser?

I've used django ImageFieldFile, from django.db.models.fields.files import ImageFieldFile now I want to restrict the user to use only Image files when uploading from browser ...

vs10 intellisense for jQuery

I'm not able to get intellisense to work with javascript/jquery code in vs10. Not even getting highlighted opening/closing bracket and parens, much less autocomplete. In VS08 we had to install a patch to get intellisense for jquery. VS10 doesn't need that patch to support -vsdoc files. There was a bug in 08's intellisense that, if any o...

Can you use constant variables in javascript?

Hi I am using visual studios 2010 and created a javascript file(jscript.js) and I saw on one page saying you can make constant variables in javascript like: const x = 20; bu to on another page I read it says you can't. So I am confused now what is it now? Also in Visual studios when I write "const" it underlines it in the javascript...

Creating a javascript function to switch classes between list elements depending on which one has been clicked.

I am trying to create a function to change the class on a series of 5 list elements depending on which has been clicked. The goal is to change the style of the element depending on which one is the current element. I had tried something like this: function addClass(obj) { obj.className="highlight"; } and then added this to my elemen...

alert box empty for php javascript

why does this script show empty alert box. I am trying to use php value in javascript <script type="text/javascript"> alert(<?php echo count($myorder) ?>); </script> thanks ...

How do I remove descendant elements from a jQuery wrapped set?

I'm a little confused about which jQuery method and/or selectors to use when trying to select an element, and then remove certain descendant elements from the wrapped set. For example, given the following HTML: <div id="article"> <div id="inset"> <ul> <li>This is bullet point #1.</li> <li>This is bullet point #2.</li>...

I can get access to object's properties if method is called from anonymous function, but I can't do it if method is called directly. Why?

Hello, $.Comment = function() { this.alertme = "Alert!"; } $.Comment.prototype.send = function() { var self = this; $.post( self.url, { 'somedata' : self.somedata }, function(data) { //using anonymous function to call object's method self.callback(data); } ); } $.Comment.prototype.c...

Combining JSON Arrays

I have 3 json arrays, each with information listed in the same format: Array: ID: NAME: DATA: ID: NAME: DATA: etc... My goal is to combine all 3 arrays into one array, and sort and display by NAME by passing the 3 arrays into a function. The function I've tried is: Javascript Call: // to save time I'm ...

How to read data between two html tags as text.

Hi, I am working on a project which needs to extract text form a predefined div tag. My requirement is to send the content in the target div in a email body. I have to use javascript or php for this task. The Process : When a given link will be clicked; a javascript function will trigger and read that target div. The content of the d...

Suppress "Done, but with errors on page" in IE

I have a website using lots of jQuery and JavaScript that produces a "Done, but with errors on page" message in the footer of IE. Everything on the site works perfectly, so I don't want to spend the time troubleshooting the exact error. All I would like to do is suppress the "Done, but with errors on page" message so that clients don't ...

How do I turn off JScript Intellisense in vs2008?

When working in VS2008 in a large aspx file the program grinds to halt updating JScript intellisense. Is their a way to turn this off? It's not listed in Tools>Options>Text Editor. Already have the AllLanguages.AutoListMembers and AllLanguages.ParameterInformation turned off. EDIT: VS2008 did not have sp1 installed. As to why it doe...

Specify only the second parameter in a javascript function

The spec for the jQuery ajax.error function is: error(XMLHttpRequest, textStatus, errorThrown)Function I'm trying to catch the error and display the textStatus, but I can't figure out how to specify only the textStatus without having to put in a variable name for XMLHttpRequest and errorThrown. My code currently looks like this: $.a...

Check if checkboxes are selected on page load and add a class to parent html li

Im looking a way to do it with prototype, this js, needs to loads with the page and interate over all the elements (inputs - checkboxes, in this case) with the given id and assign a class to its parent <li></li> The JS is: function changeSelectionStyle(id) { var inputId = id.substr(0,id.length-2); if(document.getElementById(inputId)...

Flash VS jQuery for RIAs development : Which one is better to use and for what reasons?

Can anyone please explain for developing rich internet applications which one of these two technologies (Flash VS jQuery) is better to use based on criteria such as "Pros and Cons, time, cost, situations and etc..." and why? Please explain in details, it is very confusing. Thank you. ...

Cannot retrieve referenced URL

I have JavaScript inside a .wsf file and I'm getting the error: C:\bin\LDLSInfo.wsf(53, 34) Windows Script Host: Cannot retrieve referenced URL: S:\tools\JScript\lib\StandardWSH.js At line 53, it says <script language="JScript" src="S:\tools\JScript\lib\StandardWSH.js"/> I know that LDLSInfo.wsf (the main script) and StandardWSH....

Jquery Count up Animation?

I have a a counter that needs to count up from $0 to $10,000 in x seconds (most likely 3 seconds). Just straight text, kind of like a millisecond countdown timer, but upwards and with a dollar sign. I'd rather not use a bulky plugin as this just needs to loop through 1-10,00 in x seconds and update every 100ms or so. I'm stuck at crea...

Why isn't my javascript working on a local HTML file using UIWebView loadRequest:?

Hi Everyone, I have a script that generates a temporary HTML file that has links to external Javascript files that it requires to run. <script src="file:///Users/raphaeldefranco/Library/Application Support/iPhone Simulator/User/Applications/BA9E724E-76BD-4F28-B224-54B4C73786D6/LogTen.app/Reports/Time by Year/../../Tools/PlotKit/Base.js...