
Technology Drag and Drop
In JavaScript there are no built - in events Drag and Drop which are supported by many programming languages, but there are means with which help the given technology it is possible realizovatju.
Code of a script:
<div style = " position:relative; width:450px; height:125px; cursor:pointer ">
<img src = "bear.jpg" style = " position:absolute; left:15px; top:10px "
onmousedown = " Move (this) ">
<div style = " position:absolute; left:190px; top:10px; width:170px;
border: 1px solid; padding:5; text-align:left; background-color:white "
onmousedown = " Move (this) ">
This component has the constant size.
</div>
<div style = " position:absolute; left:380px; top:10px " onmousedown = " Move (this) ">
This component has no constant size.
</div>
<script type = "text/javascript">
var SelectedItem;
var SelectedX, SelectedY;
var MouseX, MouseY;
function Move (ClickedItem)
{
SelectedItem = ClickedItem;
SelectedX = SelectedItem.style.pixelLeft;
SelectedY = SelectedItem.style.pixelTop;
MouseX = event.clientX;
MouseY = event.clientY;
document.onmousemove = Drag;
document.onmouseup = Drop;
}
function Drag ()
{
SelectedItem.style.left = SelectedX + (event.clientX - MouseX);
SelectedItem.style.top = SelectedY + (event.clientY - MouseY);
return false;
}
function Drop ()
{
document.onmousemove = null;
document.onmouseup = null;
}
</script>
With components all is understandable. We have one picture and 3 components DIV, and one of them is the container for two others and a picture.
Let's consider more in detail a code a script. By pressing a picture or the text there is an event onmousedown which causes function Move (this.) this - the name of object which has called function (for example img or div).
Global variable SelectedItem appropriates{gives} a name components which has called function
SelectedItem = ClickedItem
Coordinates of position given components are defined{determined}
SelectedX = SelectedItem.style.pixelLeft
SelectedY = SelectedItem.style.pixelTop
And also a cursor position of the mouse
MouseX = event.clientX
MouseY = event.clientY
Thus document.onmousemove function Drag which will be every time when the user will press a key of the mouse on what that a component (figure, the text), and document.onmouseup (is appropriated{given} will be executed at otpuskanii buttons of the mouse) function Drop.
Function Drag expects new coordinates of position of a picture or the text depending on an arrangement of the index of the mouse:
SelectedItem.style.left = SelectedX + (event.clientX - MouseX)
SelectedItem.style.top = SelectedY + (event.clientY - MouseY)
Function Drop deletes conformity to events a call of the certain functions:
document.onmousemove = null
document.onmouseup = null
PHP 6 on the approach
You already, probably, in a rate, that the group of developers of nucleus PHP 6 met in November, 2005 in Paris. It was the fascinating meeting on which developers have discussed development PHP from the point of view. Before I shall begin the story about the accepted decisions, is compelled to warn - all that here is listed, it not « 100 % the decided{solved} questions » and in final release PHP of 6 affairs can be differently. Certainly, all these moments will be discussed more in detail, but already now it is possible to speak about prospects.
JUnikod
Support junikoda at the moment can be established only at a level « per request », i.e. for each required file. It means, that PHP it is necessary to save variants of classes, names of methods and functions simultaneously in the table of symbols Unicode and in non-Unicode, that, certainly, increases quantity{amount} of consumed resources.
Developers have decided to make adjustment junikoda at a level of all server, instead of search. Disconnect of support junikoda if those is not required, can increase productivity of line functions up to 300 % and applications as a whole up to 25 %.
Carrying out of adjustments in php.ini will allow to remove{take off} care about junikode from the developer and to shift her{it} on
Managers of a host. If you independently collect PHP and bear the responsibility for your servers it will be useful for you to know, that for PHP 6 libraries ICU (depending on, whether will be necessary Unicode whether or not) are required.
Register Globals will become a thing of the past
Say goodbye to this adjustment, she will be finally removed{cleaned}. Such adjustment any more will not be in php.ini and if you will bring in her{it} receive a mistake of level E_CORE_ERROR. It means, that PHP 6 at last will finish an era of scripts PHP 3. It is serious, but very necessary step.
Magic Quotes will be excluded
The option magic quotes will be as is excluded from PHP and at attempt of inclusion of such adjustment, mistake E_CORE_ERROR "will jump out". It will affect on magic_quotes, magic_quotes_sybase and magic_quotes_gpc.
Any more will not be Safe Mode
It is pleasant to those, who khostitsja on servers with obligatory inclusion Safe Mode. Now, inclusion of an option will cause mistake E_CORE_ERROR. The reason for it becomes the mechanism posyla « a signal of danger » which does{makes} PHP by more safe. It will be saved only open_basedir.
'var' will be full aliasom (pseudonym) 'public'
Var it is used in classes PHP 4. In objective approach PHP 5, the use var causes a mistake of level E_STRICT. In PHP 6 prevention{warning} of a mistake will be eliminated and var becomes a full synonym public. This quite normal decision, however, those who "has adjusted" the scripts under PHP 5, have made superfluous job in this plan.
Return under the link will call a mistake
And ' $foo = and new StdClass () ' and ' function *foo ' now will call a mistake of level E_STRICT.
Compatibility with zend.ze1 will be removed{cleaned}
Ze1 Always tried to support old behaviour PHP 4, but not always « worked on 100 % », therefore in sixth version PHP he will be completely excluded.
Support Freetype 1 and GD 1 will be removed{cleaned}
Support of both (very much - very much old) libraries will be removed{cleaned}.
dl () remain only in SAPI
Each function SAPI will need to be registered and only CLI and embed SAPI will work since this moment. In other variants dl () will not work.
FastCGI it is always switched on
FastCGI the code "will be licked" and becomes switched on by default for CGI SAPI.
Thus, support FastCGI cannot be disconnected.
Old names of global files will be removed
Remember old files HTTP_ * _ VARS? If you yet have not started to use $ _GET and $POST start to do{make} it right now because in PHP 6 these files will cause E_CORE_ERROR.
Movings of expansions
Expansions XMLReader and XMLWriter will enter the distribution kit and become accessible by default. Expansion ereg for job with regular expressions will move in PECL (i.e. it will be removed from PHP). It means, that PCRE will be by default inaccessible and switched off. Such step is done{made} for inclusion of new expansion for job with the regular expressions based on ICU. extremely useful expansion Fileinfo will be switched on in the distribution kit and is accessible by default.
Additions to cursor PHP
64 bit integer type of the data
In a cursor the new type of the data - int64 will be added. He will be used by default for integer.
Goto
Any goto commands it will not be added. However, break command will extend a static label, therefore it will be possible to write break foo and it will throw on a label foo: in your code.
ifsetor ()
Similar, that we shall not see this function that is insulting. In the operator?: it will be possible to lower{omit} one parameter that will allow to write so: " $foo = $ _GET ['foo']?: 42; " (i.e. if foo is true $foo it will be equal 42). It will save a few{a little;little bit} code, however will be not so is readable, as at use ifsetor ().
foreach for multilevel files
- you can pass this excellent{different} innovation with the help foreach on several levels of a file, for example " foreach ($a as $k => list ($a, $b)) ".
{} against []
Now you can use and {} and [] for the reference{manipulation} to line indexes. However, recording {} already now will call E_STRICT in PHP 5.1 and will be completely eliminated in PHP 6. Besides, [] in part will replace substr and array_slice and you can use " [2], " for reception of symbols from the second and up to the end of a line. Very conveniently.
Changes in objective style
Sheaf static
The new keyword for access to the subsequent sheaf - static:: static2 () will be added, that will allow to operate static in execution time.
Spaces of names
This moment remains unresolved and to this day. My advice{council} - do not hold the breath.
Typified values at return from functions
Developers have expressed against typification, therefore as it « not in style PHP ». However such vozmozhnomt` it will be added, but the question of its{her} syntax is solved. In any case, it will be a useful opportunity.
The call dinamcheskikh functions as static will lead to E_FATAL
Now you can cause static and dynamic methods not paying attention on that, static they or dynamic. The call of dynamic function as static, will call E_FATAL.
























