Notepad++ select javascript content
Jak vybrat kód mezi taky v Notepad++
How to select f.e. javascript tag contetn in Notepad++
- insert content between braces
- put caret behind the last bracket
- press Ctrl + left Alt + B or Ctrl + Shift + B to control the first brace
from parentheses to braces and check the multi-line box.
Then you can Ctrl-double-click on either brace to highlight everything in between.
How to select f.e. javascript tag contetn in Notepad++
- insert content between braces
- put caret behind the last bracket
- press Ctrl + left Alt + B or Ctrl + Shift + B to control the first brace
< script>
{
var bla = 0;
// bla bla ... long content
} // place caret/cursor behind the last brace { and press Ctrl + left Alt + B (Notepad++)
< /script>
At Settings->Preferences->Delimiter, change the delimiters
from parentheses to braces and check the multi-line box.
Then you can Ctrl-double-click on either brace to highlight everything in between.
77LW NO topic_id
AD
Další témata ....(Topics)
Jak změřit čas trvání vykonání nějaké funkce, nebo provedení části kódu v PHP
$start_time = microtime(true);
// do some work
$end_time = microtime(true);
// Calculate execution time
$execution_time = ($end_time - $start_time);
echo " Execution time = ".$execution_time." sec";
Date: 11.06.2020 - 09:14Textarea selection - získání pozice karety kurzoru.
// FOR Gecko Browser selectionStart / selectionEnd selection length
function getPos(){
if (typeof document.getElementById('idTextarea').selectionStart != 'undefined') {
var nPosCursor = document.getElementById('idTextarea').selectionStart;
var nEndPos = document.getElementById('idTextarea').selectionEnd;
return nPosCursor;
}
return 0; // or -1
}
// source by javascript-array.com/guides/javascript_faq/
//Internet Explorer 4+, Mozilla/Gecko/Firefox
function getCaretPos(obj)
{
obj.focus();
if(obj.selectionStart) return obj.selectionStart; //Gecko
else if (document.selection) //Internet Explorer
{
var sel = document.selection.createRange();
var clone = sel.duplicate();
sel.collapse(true);
clone.moveToElementText(obj);
clone.setEndPoint('EndToEnd', sel);
return clone.text.length;
}
return 0;
}
Některé funkce pracující s polem v JavaScriptu
var myArray = []; // smazat obsah, nebo inicializovat nove pole
concat([item1[, item2[, . . . [, itemN]]]])
concat([string2[, string3[, . . . [, stringN]]]])
/* spoji stringy nebo pole a vraci novy string nebo pole */
join(separator)
/* vrati v string spojene itemy poli oddelene separatorem*/
push([item1 [item2 [. . . [itemN ]]]])
/* prida na konec pole novy item a vraci delku pole*/
pop()
/* odebere posledni element z pole a vrati jeho hodnotu*/
reverse()
/*vraci obracene poradi itemu pole*/
shift()
/* odebere prvni item z pole a vrati jej*/
slice(start, [end])
/* varaci cast pole*/
var numArray = new Array(3,2,5,9);
var newNumArray = numArray.slice(1,3); // 2,5
sort() // string
sort(sortFunction)
/* setridi pole cisel od nejvetsiho - descending */
sort(function(a, b){return b-a})
/* setridi od nejmensiho cisla - ascendant*/
sort(function(a, b){return a-b})
splice(start, deleteCount, [item1[, item2[, . . . [,itemN]]]])
/* odebere element z pole, popripade vlozi novy a vrati odebrany element*/
var numArray = new Array(3,2,5,9);
var newNumArray = numArray.splice(1,1); // 3,5,9
unshift([item1[, item2 [, . . . [, itemN]]]])
/* prida na pocatek item, ktery je parametrem funkce */
var myA = new Array(10,11,12);
myA.unshift(1); // 1,10,11,12
Jak snadno vložit na stránku přenositelný kód s copyright vašich stránek v php.
<font color=#3E845E size="0.8px">Copyright © 2008-<?php print date("Y").' '.$_SERVER ["HTTP_HOST"];?>, all right reserved
</font><br>
Toogle DIV javascript example code:
Jak skrýt, nebo zobrazit kontejner DIV:Nezapomeňte přiřadit DIVu ID, aby k němu bylo možno přistupovat pomocí getElementById a vše fungovalo i v jiných prohlížečích (Opera, Firefox, Google Chrome) a ne jen v Internet Exploreru.
<div id="idSomeDiv"> text div </div>
<input type="button" size="200" value="Skryj-zobraz"
onclick="var dH = document.getElementById('idSomeDiv');
if(dH.style.visibility == 'hidden') {
dH.style.visibility = 'visible';
} else {
dH.style.visibility = 'hidden';
}">
Editace: 14.5.2020 - 11:03
Počet článků v kategorii: 77
Url:notepad-select-javascript-content-id-2346