javascript

Select which Right-Click menu items to display in IE

I'd like to disable the 'Refresh' option in the right-click menu for internet explorer. Our application uses Javascript, ASP.Net and VB, but I'm sure it'll need to be done through Javascript. Any code snippets would be greatly appreciated. Thanks ...

from JS to iphone dev - what's the best language to start with?

I am a total beginner and would like to eventually learn to develop for the iphone. I have just done a beginner's CS course where the language we learned was JavaScript. We studied basic concepts like: variables, arrays, loops (for,while,if,if..else..), properties and functions. I'm wondering if I am starting in the right/wrong place b...

Determine HTML page that called a function in an external js file

Is it possible to determine this at runtime? contents of external.js: function x() { //can i get the path/name of the html file that included this js file? //which is test.html } contents of test.html script src="external.js" ...

Problem with adding integers in an array

Hello again, I'm trying to loop through my totals in order to get a grand total for my web app. So far the code I am working with is the following: function calcAllFields() { var name = parseFloat($('div [name = total[]]').text()); var totArray = $.makeArray(name); var total = 0; for (var i = 0; i < totArray.length;...

Select next element in the page source using jQuery

I have an arbitrarily deep list of the form: <ul> <li></li> <li> <ul> <li></li> </ul> </li> </ul> I am trying to build a function "nextElement" that returns a jQuery selector. The first time the function is called, it returns the first li in the list. The second time it is called, it returns the next li in the page. Etc. ...

Javascript regular expressions: how to match ONLY the given characters?

I'm trying to use a regex like /[computer]{3,8}/ to get any words containing only the letters in computer ranging from 3 to 8 letters long. That regex instead captures all words containing ANY of the letters in [computer]. I've been looking at regular expression examples, but i can't quite figure it out... How do i modifiy this regular ...

using php and java script in a form

I am a little bit lost. What I want to achieve is: my own custom button change onMouseOver etc' keep it's size post the information to a php server side code What I'm missing is: The post - I couldn't figure out how to combine js & php The Button size - my code sets a size for the original button but after the rollover it changes ...

Switching function states

Dear experts, I would like to implement a API of Javascript that sort of resemble a light switch. For instance, there are two buttons on the actual HTML page act as the UI. Both of the buttons have event handlers that invokes a different function. Each function have codes that act like a state, for instance. button1.onclick=functio...

How do i hide html until its processed with javascript?

I am using some JS code to transform my menu into a drilldown menu. The problem is before it runs the JS you see a BIG UGLY mess of links. On their site its solved by putting the js at the top. Using recommendations by yahoo/YSlow i am keeping the JS files at the bottom. I tried hiding the menu with display:none then using jquery to .s...

Bind event on another window.

I'm working on an image browser/upload feature, and I'm using PHP Image Editor to help me allow users to edit their images once they've been uploaded. Images are not stored on the web server, but on a separate file server. So what I do is: when an image is selected for editing from the image browser page, I download the image from t...

Capitalize first letter following colon and ?: Javascript

I'd like to capitalize the first letter following a colon or an ? in javascript. Ex. Coregulation: an integrative analysis --> Coregulation: An integrative analysis Or: Coregulation? an integrative analysis --> Coregulation? An integrative analysis I'd like to make the replacement during the body onload, which I already use to make so...

short hand for chaining logical operators in javascript?

Is there a better way to write the following conditional in javascript? if ( value == 1 || value == 16 || value == -500 || value == 42.42 || value == 'something' ) { // blah blah blah } I hate having all of those logical ORs strung together. I'm wondering if there is some kind of shorthand. Thanks! ...

why is link generated in YUI javascript failing to render in rails?

Using YAHOO.widget.treeview to generate a table with three levels of data: module, submodule, and detail. If there is an image associated with a detail row the javascript generates a link: "<td><a href=\"/screenshot/show/" + rowData.id + "\">Screenshot</a></td>" that is appended to the html for the row. The url is generated correct...

Is there any difference between var name = function() {} & function name() {} in Javascript?

Suppose we are inside a function and not in the global namespace. function someGlobalFunction() { var utilFunction1 = function() { } function utilFunction2 () { } utilFunction1(); utilFunction2(); } Are these synonymous? And do these functions completely cease to exist when someGlobalFunction returns? Should I prefer on...

What is the compatible JQuery line of code for IE7 and IE8?

This line of code is working fine for Firefox $("#<%=txt1.ClientID%>").text() but not for IE8 and IE7. See the scenario below in order to understand what I really mean:- Scenario:- Loading .aspx page. populating text box with some data from database. Now user changes data in same text-box at client-side (means page not yet submitt...

Uploading file with unique constraints

I am looking for a simple way to do a file upload, but unfortunately with a set of unique constraints: I have an event handler for a button click. In this event handler, I would like to make some call to pop up the "Browse for File" dialog box (which is a native OpenFileDialog box). Users would navigate and select a file to upload. ...

λ and function javascript

is there any way to map the λ key to the function keyword? so that these work: var rFalse = λ() { return false; } (λ(){ var str = "i'm in a closure"; }()); window.onload = λ() { alert('window loaded'); } I know that they are attempting to put a shortened function keyword in ecmascript v6, but I'm wondering if it is possible to...

How do I disable the button wrapper for jquery-ui-datepicker?

See this sample page. The icon I want to be using is this: The icon, as shown on the page, looks like this: How can I make DatePicker use my original icon without modifications? ...

How do I scope variables properly in jQuery?

I'm working on a jQuery plugin, but am having some trouble getting my variables properly scoped. Here's an example from my code: (function($) { $.fn.ksana = function(userOptions) { var o = $.extend({}, $.fn.ksana.defaultOptions, userOptions); return this.each(function() { alert(rotate()); // o is not defined }); };...

Using custom buttons with js & php

How can I make a form with my own "submit" button & post the info to a php server side? how can I get js to post it? ...