jQuery部分:
$(document).ready(function () {
$('img.menu_class').click(function () {
$('ul.the_menu').slideToggle('medium');
});
});
$('img.menu_class').click(function () {
$('ul.the_menu').slideToggle('medium');
});
});
1、引入JQUERY
2、把文章末尾的代码复制保存为以下文件里面
3、调用语句,和jquery一摸一样,可以这样调用,记得是在页面底部,</body>标签之前调用
或者这样调用
<script type="text/javascript" src="http://code.jquery.com/jquery-1.7.1.min.js"></script>
2、把文章末尾的代码复制保存为以下文件里面
<script src="js/MinmyLazyload.js" type="text/javascript"></script>
3、调用语句,和jquery一摸一样,可以这样调用,记得是在页面底部,</body>标签之前调用
<script type="text/javascript">$("img").lazyload(); </script>
或者这样调用
function senfe(o, a, b, c, d) {
var t = document.getElementById(o).getElementsByTagName("tr");
for ( var i = 0; i < t.length; i++) {
t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
t[i].onclick = function() {
if (this.x != "1") {
this.x = "1";// 本来打算直接用背景色判断,FF获取到的背景是RGB值,不好判断
this.style.backgroundColor = d;
} else {
this.x = "0";
this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
}
}
t[i].onmouseover = function() {
if (this.x != "1"){
this.style.backgroundColor = c;
}
}
t[i].onmouseout = function() {
if (this.x != "1"){
this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a:b;
}
}
}
}
//senfe("table ID","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
senfe("senfe","#fff","#F3F8F7","#CFC","#CF9");
var t = document.getElementById(o).getElementsByTagName("tr");
for ( var i = 0; i < t.length; i++) {
t[i].style.backgroundColor = (t[i].sectionRowIndex % 2 == 0) ? a : b;
t[i].onclick = function() {
if (this.x != "1") {
this.x = "1";// 本来打算直接用背景色判断,FF获取到的背景是RGB值,不好判断
this.style.backgroundColor = d;
} else {
this.x = "0";
this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a : b;
}
}
t[i].onmouseover = function() {
if (this.x != "1"){
this.style.backgroundColor = c;
}
}
t[i].onmouseout = function() {
if (this.x != "1"){
this.style.backgroundColor = (this.sectionRowIndex % 2 == 0) ? a:b;
}
}
}
}
//senfe("table ID","奇数行背景","偶数行背景","鼠标经过背景","点击后背景");
senfe("senfe","#fff","#F3F8F7","#CFC","#CF9");
$(function(){
$("tbody > tr:even").addClass("Single"); //单
$("tbody > tr > td").dblclick(function(){
var inval = $(this).html();
var infd = $(this).attr("fd");
var inid = $(this).parents().attr("id");
$(this).html("<input id='edit" + infd + inid + "' value='" + inval + "' />");
$("#edit" + infd + inid).focus().live("blur",function(){
var editval = $(this).val();
$(this).parents("td").html(editval);
$.post("post.php",{id:inid,fd:infd,val:editval});
});
});
});
$("tbody > tr:even").addClass("Single"); //单
$("tbody > tr > td").dblclick(function(){
var inval = $(this).html();
var infd = $(this).attr("fd");
var inid = $(this).parents().attr("id");
$(this).html("<input id='edit" + infd + inid + "' value='" + inval + "' />");
$("#edit" + infd + inid).focus().live("blur",function(){
var editval = $(this).val();
$(this).parents("td").html(editval);
$.post("post.php",{id:inid,fd:infd,val:editval});
});
});
});
<input type="file" name="file1" id="file1" size="40" onchange="changeSrc(this)"/>
<img src="about:blank" id="fileChecker" alt="test" height="18"/>
<script type="text/javascript">
var oFileChecker = document.getElementById("fileChecker");
function changeSrc(filePicker)
{
oFileChecker.src = filePicker.value;//读图片
}
</script>
<img src="about:blank" id="fileChecker" alt="test" height="18"/>
<script type="text/javascript">
var oFileChecker = document.getElementById("fileChecker");
function changeSrc(filePicker)
{
oFileChecker.src = filePicker.value;//读图片
}
</script>
用jQuery做了一个隔行换色的插件放出来共享。
(function($){
$.fn.extend({
"SetTableBgColor" : function(options){
option = $.extend({
Odd : "Odd", //奇数
Even : "Even", //偶数
Selected : "Selected", //选中
Over : "Over" //鼠标移上去
},options); //此处options与function里的参数为同一个对象
//隔行换色
$("tbody > tr:even", this).addClass(option.Even);
$("tbody > tr:odd", this).addClass(option.Odd);
//鼠标移上去
$("tbody > tr", this).mouseover(function(){
if ($(this).hasClass(option.Selected) == false){
$(this).addClass(option.Over);
}
});
//鼠标移出
$("tbody > tr", this).mouseout(function(){
$(this).removeClass(option.Over);
});
//单击变色
$("tbody > tr", this).click(function(){
$("tbody > tr").removeClass(option.Over);
if ($(this).hasClass(option.Selected) == false){
$(this).addClass(option.Selected);
}else{
$(this).removeClass(option.Selected);
}
});
return this;
}
});
})(jQuery);
$.fn.extend({
"SetTableBgColor" : function(options){
option = $.extend({
Odd : "Odd", //奇数
Even : "Even", //偶数
Selected : "Selected", //选中
Over : "Over" //鼠标移上去
},options); //此处options与function里的参数为同一个对象
//隔行换色
$("tbody > tr:even", this).addClass(option.Even);
$("tbody > tr:odd", this).addClass(option.Odd);
//鼠标移上去
$("tbody > tr", this).mouseover(function(){
if ($(this).hasClass(option.Selected) == false){
$(this).addClass(option.Over);
}
});
//鼠标移出
$("tbody > tr", this).mouseout(function(){
$(this).removeClass(option.Over);
});
//单击变色
$("tbody > tr", this).click(function(){
$("tbody > tr").removeClass(option.Over);
if ($(this).hasClass(option.Selected) == false){
$(this).addClass(option.Selected);
}else{
$(this).removeClass(option.Selected);
}
});
return this;
}
});
})(jQuery);
对象属性
———————————————————————
常用对象方法
———————————————————————
body-主体子对象
document.title //设置文档标题等价于HTML的title标签
document.bgColor //设置页面背景色
document.fgColor //设置前景色(文本颜色)
document.linkColor //未点击过的链接颜色
document.alinkColor //激活链接(焦点在此链接上)的颜色
document.vlinkColor //已点击过的链接颜色
document.URL //设置URL属性从而在同一窗口打开另一网页
document.fileCreatedDate //文件建立日期,只读属性
document.fileModifiedDate //文件修改日期,只读属性
document.fileSize //文件大小,只读属性
document.cookie //设置和读出cookie
document.charset //设置字符集 简体中文:gb2312
document.bgColor //设置页面背景色
document.fgColor //设置前景色(文本颜色)
document.linkColor //未点击过的链接颜色
document.alinkColor //激活链接(焦点在此链接上)的颜色
document.vlinkColor //已点击过的链接颜色
document.URL //设置URL属性从而在同一窗口打开另一网页
document.fileCreatedDate //文件建立日期,只读属性
document.fileModifiedDate //文件修改日期,只读属性
document.fileSize //文件大小,只读属性
document.cookie //设置和读出cookie
document.charset //设置字符集 简体中文:gb2312
———————————————————————
常用对象方法
document.write() //动态向页面写入内容
document.createElement(Tag) //创建一个html标签对象
document.getElementById(ID) //获得指定ID值的对象
document.getElementsByName(Name) //获得指定Name值的对象
document.body.appendChild(oTag)
document.createElement(Tag) //创建一个html标签对象
document.getElementById(ID) //获得指定ID值的对象
document.getElementsByName(Name) //获得指定Name值的对象
document.body.appendChild(oTag)
———————————————————————
body-主体子对象
<script type="text/javascript">
//检索A标记,符合的条件的改自己的值
$().ready(function(){
$('a').each(function(){
if($(this).text()=='Yxly330'){
$(this).text('快乐飞扬论坛');
}
})
})
//替换唯一标签的值
document.title = "快乐飞扬论坛";
</script>
//检索A标记,符合的条件的改自己的值
$().ready(function(){
$('a').each(function(){
if($(this).text()=='Yxly330'){
$(this).text('快乐飞扬论坛');
}
})
})
//替换唯一标签的值
document.title = "快乐飞扬论坛";
</script>


