1>jQuery获取value值 <script type="text/javascript"> $(document).ready(function(){ $("p").append( "<b>Single:</b> " + $("#single").val() + " <b>Multiple:</b> " + $("#multiple").val().join(", ") ); }); </script> 2>jQuery快数隐藏表格(特效) <script type="text/javascript"> $(document).ready(function(){ $("#table").hide("fast",function(){ alert("Animation Done!"); }); }); </script> 3>jQuery + ajax + json 获取HTML内容 POST提交模式 <script type="text/javascript"> $(document).ready(function(){ $('#btnAjax').click(function(){ $.ajax({ type:"post", url:"json.html", success:function(msg){ var oldvalue = $('#div1').html() + '</br>'; $('#div1').html(oldvalue + msg); } }); }); }) </script> 4>jQuery 获取HTML 标签里面的内容 <script type="text/javascript"> $(document).ready(function(){ $('#div1').html(); $('#div1').html("123"); }) </script> 5>jQuery 设置CSS样式, 相当于innerHTML <script type="text/javasript"> function sure() { var val = "#" + $("#txt").val(); $(document.body).css( "background", val); } </script> 6>JS打开自定义对话框 urlPath : 对应页面url isModelessDialog : 对话框标识 windowName : 未知 width : 宽度 height : 高度 windowProperty ; 对话框参数信息 function getDialog(urlPath, isModelessDialog, windowName, width, height, windowProperty){ if(urlPath == undefined) { return null; } if(isModelessDialog == undefined) { isModelessDialog = "0"; } if(windowName == undefined) { windowName = "myAnonymousWindow"; } if(width == undefined) { width = "700"; } if(height == undefined) { height = "500"; } var xposition = 0; var yposition = 0; if ((parseInt(navigator.appVersion) >= 4 )) { xposition = (screen.width - width) / 2; yposition = (screen.height - height) / 2; } if(windowProperty == undefined) { if(isModelessDialog == "1") { windowProperty= "width=" + width + "," + "height=" + height + "," + "location=0," + "menubar=0," + "resizable=1," + "scrollbars=1," + "status=0," + "titlebar=0," + "toolbar=0," + "hotkeys=0," + "screenx=" + xposition + "," //Netscape 浏览器 + "screeny=" + yposition + "," //Netscape 浏览器 + "left=" + xposition + "," //IE浏览器 设置对话框距离左边的距离 + "top=" + yposition; //IE浏览器 设置对话框距离顶部的距离 } else { windowProperty = 'dialogHeight=' + height + 'px;dialogWidth=' + width + 'px;'; } } if(isModelessDialog == "1") { window.open( urlPath,windowName,windowProperty ); return new Object(); } else { var returnObj = window.showModalDialog(urlPath,windowName,windowProperty); if(returnObj != undefined) { return returnObj; } else { return new Object(); } } }