OOP syntax in js and using prototype

What is the difference between these pieces of code and which is preferable in which cases? A  function Obj() {} Obj.method = function(type) { return this.coords[type]; }; var obj = new Obj(), current = obj.method(type);   B  function Obj() {} Obj.prototype.method = function(type) { return this.coords[type]; }; var obj = new Obj(), current = obj.method(type); C  var obj = { method : function(type) { return this.coords[type]; } }, curre... Read more

advise javascript calendar

of the requirements:  - Easy navigation  - The week should start on Monday  - Russian language  - It is desirable that the date is not inserted into the entry, and clicking on the date sent POST I was looking for file dumps, did not find anything suitable :( Read more

Drag'n'drop for dynamically created elements (jQuery)?

jQuery has such a nice plugin jQuery UI Draggable that allows you to create drag'n'drop effects. It works quite simply: you need to call .draggable () method for any existing element: $ ('# test'). Draggable (); If you try to call this method for a dynamically added element, nothing will happen: $('body').append('<div id="newblock">Новый элемент</div>'); $('#newblock').draggable(); "New item" will not have the ability to drag'n'drop. How to do something like an analogue of th... Read more

How to scale the font so that it takes a whole block?

Success on Habré of a light start-up link to help me dig on Sunday evening in the direction link (IE users are sorry). It works only in 1280x1024 resolution, and the magic code = (900 - 3 * message.length) + '%'; is used to calculate the font size. At the same time, there are still problems if someone uses the + & quot; + & quot ;. How would you make the font size fit to fill the div? Can it be adaptive to increase and somehow calculate the size of the resulting b... Read more

Extra comma in JS

There was a dispute over an error that occurs in IE, if there is an extra comma in the code. The situation is simple:  items: [ {xtype: 'textfield', cls: 'fake-field', value: 'Manager Login'}, new Ext.form.TextField(Ext.applyIf({fieldLabel: 'Username', name: 'login', allowBlank:false}, fieldConfig)), this.passwordField, this.passwordConfirmField, new Ext.form.Hidden({name: 'companyId'}), ] If the last comma is not removed - IE does not work the script. All other browsers will work w... Read more

[jQuery UI tabs + layout] layout inside the tab to the full screen ... how?

Good day ... Trying to have a splitter inside one of the tabs like this:  <link type="text/css" rel="stylesheet" href="css/smoothness/jquery-ui-1.8.4.custom.css"/> <link type="text/css" rel="stylesheet" href="css/jquery-layout.css"/> <script type="text/javascript" src="js/jquery-1.4.2.min.js"/> <script type="text/javascript" src="js/jquery-ui-1.8.4.custom.min.js"/> &l... Read more

Does form-builder (PHP) + validator (client + server) exist in nature in one bottle?

Is there a flexible form-builder (PHP) that allows you to simultaneously assign rules for server and client validation? Actually the question of not repeating the same work twice, in particular at Habré link, an attempt to understand this problem was suggested and one of the outputs was suggested (or rather, its prototype) and how it was correctly noted: main idea - generating client validation on the server For example, for client validation and building all sorts of goodies like re... Read more

Controlling the state of transparency JavaScript

Good morning, Habr! The task that stands before me is simple and as old as the world - an animated change of one picture by another when you hover the mouse. The pictures have the same size, one is just a button, the other is a button with a “hover state”, the buttons are absolutely positioned and are “in each other”. In the primitive, the problem is solved by such lines of code in jQuery:  $('div#left ul li').css({opacity: 0.0}); $('div#left ul li:first').css({opacity: 1.0}); $("div#... Read more

Tell me a good html5 audio player

I wanted to implement for my site audio playback without a flash, but I could not find a good tool for working with playlists and having sufficiently many settings. You need something resembling prostopleer and Read more

jQuery - select elements only with a specific set of classes

Perhaps a stupid question, but I can't figure it out. There are 3 blocks with a .one class and one block with a .one and .two class. How can I select only an element in jQuery that has both .one and .two classes? Read more

Useful Links