javascript

Error when opening the extensions manager from Xul app

When I open the extensions manager in my Xul app using: app = "chrome://mozapps/content/extensions/extensions.xul"; window.open(app,'Test','chrome, width=640, height=480').moveTo(0,0); I get the following error in the javascript console: Error: uncaught exception: [Exception... "Component returned failure code: 0x8000ffff (N...

What is an approperiate content-type header for Javascript files

I am delivering a JS response from a PHP file, while setting the content-type header which value should I use, application/javascript or text/javascript ? whats the difference between two ? ...

Chaining constructors in JavaScript

Hello! I'm trying to implement some kind of class hierarchy in JavaScript. I think I understood the prototype chain, but I still have to sort out the constructor-chaining. Following David Flanagan's Definitive Guide, I wrote function DerivedClass() { BaseClass.apply(this, arguments); // chain constructors // do some initializa...

Javascript function from ASP.Net Code behind

I am trying to call javascript from the page code behind on a button click using the following code. System.Text.StringBuilder sb = new System.Text.StringBuilder(); sb.Append("<script language=\"javascript\">"); sb.Append("alert(\"Some Message\")"); sb.Append("</script>"); ...

Javascript loop limit to delete select list keeps changing

Hi, im trying to delete a HTML select list. This is what im using: var size = DID(SourceDiv + Number).options.length; DeleteSelectElements(SourceDiv+Number,size); function DeleteSelectElements(Div,Len){ var k; var Length = Len for (k = 0; k < Length; k++) { DID(Div).options[k] = null; } } DID just returns ...

jQuery autocomplete result for google map api

I'm using jQuery's autocomplete. I'd like to draw the map based on the result that is selected from the autocomplete. I have the lat/long to use captured in variable "latlong" autocomplete code: http://pastebin.com/YTNnDS51 google map code: var map = new GMap2($("#map").get(0)); var burnsvilleMN = new GLatLng(latlong); map.setCe...

Resize and Center image with jQuery

Hello, Looks like I haven’t explained myself well. I do apologize for that. I have edited this question to make it more clear. The scenario We have a website that doesn’t host the images. What it does is a reference to an image in other server. The plan Resize images keeping proportions. Center resized images. Flexible so it c...

javascript functions not working when in put in different files.

I'm new to this whole thing, and am making a web app that relies heavily on dynamically loaded html pages into a div on the main page. The main page links to various js files including jquery and some of my own. As well as this, each of the loaded html files links to its own js file to control user interaction. And some of them also ...

jquery autocomplete enter key

Hi, Currently the autocomplete action when pressing the enter key on a selected element is to put that elements value into the input box. How can I modify the behavior so that pressing the enter key on an element triggers that elements embedded url. To simplify I'd like to make the enter key have the same behavior as a mouse click on a...

javascript + asp.net - Calling javascript functions from c# and passing an object

I'm fairly new to web development. Basically I'm using a HTML5 canvas to render content, and javascript functions which clear and render to the canvas. I'm hoping to call a web service to get data that would affect content, which I believe is most easily done from C#, and was wondering how I could use this to periodically call a javasc...

Create a sort of "Ext.data.StoreView" from multiple Ext.data.Store objects

Here is what I would like to achieve: have an Ext.grid.GridPanel show data from multiple stores. Put in "DB terms", basically showing what would be a "view" of the content of more than one store. The benefit of this approach, as opposed to using cell-renderers, is that all columns would be sortable and searchable. For this to work an o...

Using the Prototype object correctly

HI, I have a JavaScript program that's written with object literal syntax: var MyJsProgram = { someVar: value1, somevar2: value2, init : function() { //do some initialisation }, libraryFunction : function() { }, getStyle : function() { }, extend : function() { } } There can be m...

how to query for xml attribute after select change

Hi all, I have successfully loaded the xml and everything works fine if the success function runs right after loading the XML. But I wanted to get the value of the attribute after the onChange event takes place on the select box (which changes tmpproj value). When I try to access the success function checkimgs() it says $(xml) is not de...

Is there a way to override CKEditor's config file for each instance of the editor?

I have a global size and height set CKEDITOR.editorConfig = function( config ) { config.height = '400px'; config.width = '600px'; ... And I would like to change this height and width for only one instance of the editor on a seperate page. Has anyone else accomplished this? ...

Enter-key Prevention Javascript Not Working for JSF 1.1 in IE

Notes on environment: JSF 1.1 using Infragistics component library. I'm using the following Javascript to attempt to prevent an 'Enter' keypress from submitting a form. function disableEnterKey(e){ var key; if(window.event) key = window.event.keyCode; else key = e.which; return (key !...

How to control HTML5 video with javascript ?

Hi,I've searched so much about HTML5 video control and I'm stuck at controlling video with javascript.There is a rule in application you should know. There will not be any user interaction with browser at any time. What I'm trying to achieve is 1) Open video as fullscreen and play video 2) When video is ended,close video and video wil...

Anyone using Knockoutjs with asp.net-mvc in anger?

I find it very interesting and have a prototype working based on Steve's mvc sample and another small sample from this thread. Using json.net to deserialize within the post action as I couldn't figure how to downgrade his FromJsonAttribute from .net 4 to .net 3.5, which I'm running in this case. Wanted to know if anyone had put the Kno...

chars missing in textarea

Hi I have a textarea in a form, the data used ind the field comes from an sql call. When i load the form not all text is displayed, just the first line. But when i press space, inter, backspace or another button, all text is displayed anyone have a solution! /RMalberg ...

how do I filter by a substring in HTML?

I have the following function: var $content = $("#content"); var $map= $("#map"); $.each(plots, function() { var plot = this; var $plot = $("<a />") .css({ 'width': plot.width, 'height': plot.height, 'top': plot.top, 'left': plot.left, 'background': plot.color, }) .hover(functio...

Javascript and prototype chaining (methods and vars not being looked up at prototypes)

Hi, I finished reading "Object Oriented Javascript". I'm following this code to "inherit" and object from another: function deriveFrom(child,parent) { if (parent == this) alert("You can't inherit from self class type") else { var f = function () { } f.prototype = parent.prototype; child.proto...