ͨ¹ýJavaScript½øÐÐÑéÖ¤
ʵÀýÈçÏ£ºjavascript.htmlÎļþ
<html>
<head>
<title>JavaScriptÑéÖ¤</title>
</head>
<script language='JavaScript'>
function check()
{
if(form1.text1.value=="") //ÑéÖ¤ÐÕÃûÊÇ·ñΪ¿Õ
{
window.alert("Óû§Ãû²»ÄÜΪ¿Õ£¬ÇëÖØÐÂÊäÈë");
form1.elements(0).focus();
}
else if(form1.text2.value=="") //ÑéÖ¤EmaiÊÇ·ñΪ¿Õ
{
window.alert("Email²»ÄÜΪ¿Õ£¬ÇëÖØÐÂÊäÈë");
form1.elements(1).focus();
}
else if(form1.text2.value.indexOf('@')==-1) //ÑéÖ¤EmaiÊÇ·ñûÓÐ@¶øÊäÈë´íÎó
&n
Ïà¹ØÎĵµ£º
ÍøÒ³³£ÓÃС¼¼ÇÉ
1. oncontextmenu="window.event.returnValue=false" ½«³¹µ×ÆÁ±ÎÊó±êÓÒ¼ü
<table border oncontextmenu=return(false)><td>no</table> ¿ÉÓÃÓÚTable
2. <body onselectstart="return false"> È¡ÏûÑ¡È¡¡¢·ÀÖ¹¸´ÖÆ
3. onpaste="return false" ²»×¼Õ³Ìù
4. oncopy="return fa ......
B.1 anchor¶ÔÏó
¡¡¡¡Ê¹ÓÃ<A NAME=>±ê¼Ç´´½¨µÄhtmlÃèµãÄܱ»Ò»¸öÁ´½Ó×÷ΪĿ±êÈç¹ûêµã°üÀ¨HREF=ÌØÐÔ,ÔòËüÒ²ÊÇÒ»¸öÁ´½Ó¶ÔÏó¡£
¡¡¡¡anchor¶ÔÏóÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,Ëü±¾ÉíûÓÐÊôÐÔ·½·¨»òÕßʼþ´¦Àí³ÌÐò¡£
¡¡¡¡B.2 anchorsÊý×é
¡¡¡¡anchorsÊý×éÊÇdocument¶ÔÏóµÄÒ»¸öÊôÐÔ,ÊÇÎĵµÄÚËùÓÐanchor¶ÔÏóµÄÒ»¸öÁбíÈç¹ ......
¸ù¾ÝÉí·ÝÖ¤ºÅÂëÈ¡µÃÉúÈÕÓëÐԱ𣬲¢ÅжÏ18λÉí·ÝÖ¤µÄÕýÈ·Óë´íÎó:
function showBirthday(val){
var birthdayValue;
if(15==val.length){//15λÉí·ÝÖ¤ºÅÂë
birthdayValue = val.charAt(6)+val.charAt(7);
if(parseInt(birthdayValue)<10){
birthdayValue = '20'+birthdayValue;
}else{
birthdayValue = '1 ......
IE¹¦ÄÜ»ã×Ü
<OBJECT id=WebBrowser height=0 width=0
classid=CLSID:8856F961-340A-11D0-A96B-00C04FD705A2></OBJECT>
<INPUT onclick=document.all.WebBrowser.ExecWB(1,1) type=button value=´ò¿ª name=Button1>
<INPUT onclick=document.all.WebBrowser.ExecWB(4,1) type=button value=Áí´ ......
ÐèÒªÒýÈëjquery-1.3.2.js
»ñÈ¡¿í¶È
function getCurrentWidth(){
var currentWidth = 0;
// handle IE 6
if ($.browser.msie && $.browser.version < 7) {
var scrollWidth = Math.max(
document.documentElement.scrollWidth,
docu ......