Cette libre de HTML JavaScript tutorial fournit 45 + JavaScript/jQuery conseils et astuces qui vous aideront
- Demo
- Agrandir
- Recharger
- New window
G�n�rez vos vid�os d'entreprise par l'IA avec la voix ou simplement du texte
Votre premi�re application vid�o AI GRATUITE ! Automatisez votre premi�re vid�o AI. Cr�ez votre vid�o professionnelle en 5 minutes gr�ce � l'IA. Aucun �quipement ni comp�tence en montage vid�o requis. Production vid�o sans effort pour les sp�cialistes du marketing de contenu.
1.
var
count = 0;
2.
function
myFunction() {
3.
count++;
4.
if
(count > 5) clearInterval(timeout);
5.
//do something
6.
}
7.
var
timeout = setInterval(myFunction, 20000);
1.
if
($(
"#elementid"
).length) {
2.
//it does!
3.
}
01.
var
req = $.ajax({
02.
type:
"POST"
,
03.
url:
"someurl"
,
04.
data:
"id=1"
,
05.
success:
function
(){
06.
//something
07.
}
08.
});
09.
//Cancel the Ajax Request
10.
req.abort()
01.
$(document).ready(
function
() {
02.
var
dt =
new
Date();
03.
dt.setSeconds(dt.getSeconds() + 60);
04.
document.cookie =
"cookietest=1; expires="
+ dt.toGMTString();
05.
var
cookiesEnabled = document.cookie.indexOf(
"cookietest="
) != -1;
06.
if
(!cookiesEnabled){
07.
//cookies are not enabled
08.
}
09.
});
1.
var
tog =
false
;
// or true if they are checked on load
2.
$(
'a'
).click(
function
() {
3.
$(
"input[type=checkbox]"
).attr(
"checked"
,!tog);
4.
tog = !tog;
5.
});
1.
$(
"ul > li"
).click(
function
() {
2.
var
index = $(
this
).prevAll().length;
3.
});
01.
$(
"#lda-form"
).submit(
function
(){
02.
var
day = $(
"#day"
).val();
03.
var
month = $(
"#month"
).val();
04.
var
year = $(
"#year"
).val();
05.
var
age = 18;
06.
var
mydate =
new
Date();
07.
mydate.setFullYear(year, month-1, day);
08.
09.
var
currdate =
new
Date();
10.
currdate.setFullYear(currdate.getFullYear() - age);
11.
if
((currdate - mydate) < 0){
12.
alert(
"Sorry, only persons over the age of "
+ age +
" may enter this site"
);
13.
return
false
;
14.
}
15.
return
true
;
16.
});
1.
if
($(element).is(
":visible"
)) {
2.
//The element is Visible
3.
}
01.
<div id=
"foo"
>
02.
<div id=
"bar"
></div>
03.
<div id=
"baz"
>
04.
<div id=
"biz"
>
05.
</div>
06.
<span><span>
07.
</div>
08.
09.
//jQuery code to count child elements
10.
$(
"#foo > div"
).length
01.
jQuery.fn.center =
function
() {
02.
this
.css(
"position"
,
"absolute"
);
03.
this
.css(
"top"
, ( $(window).height() -
this
.height() ) / 2+$(window).scrollTop() +
"px"
);
04.
this
.css(
"left"
, ( $(window).width() -
this
.width() ) / 2+$(window).scrollLeft() +
"px"
);
05.
return
this
;
06.
}
07.
08.
//Use the above function as:
09.
$(element).center();
- Sent (0)
- Nouveau