Java学习13

Posted axu-xxx

tags:

篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了Java学习13相关的知识,希望对你有一定的参考价值。

创建表格insertRow(index)用双重for循环可以创建表格
deleteRow(index)删除行
deleteCell(index)删除列
createCaption()创建表格标题
deleteCaption()删除表格标题

时间监听
1、直接绑定html 在标签内添加onclick
2、绑定dom元素,通过js函数进行执行


onclick 单击鼠标左键触发
ondblclick双击鼠标左键触发
onmousedown单击任意一个鼠标按键时触发
onmouseout鼠标指针移出一个元素边界时触发
onmousemove鼠标在某个元素上移动时持续触发
onmouseup松开鼠标任意一个按键时触发
onmouseover鼠标指针移到一个元素上时触发
HTML事件:
onload页面完全加载后在window对象上触发
onunload页面完全卸载后再window对象上触发
onselect选择了文本框的一个或多个字符时触发
onchange文本框失去焦点时,并且在它获取焦点后内容发生过改变时触发
onsubmit单击“提交”按钮时在表单form上触发

 

 

 

代码

轮播图的制作

<script type="text/javascript">
/*将路径封装到数组中*/
var arr=[
"img/1.jpg",
"img/2.jpg",
"img/3.jpg",
"img/4.jpg",
"img/5.jpg",
"img/6.jpg",
"img/7.jpg",
"img/8.jpg"
];
/*定义下表*/
var index=0;
/*定义拖元素*/
var img
/*页面加载完成执行*/
window.onload=function()
img=document.getElementById("pic")
timer=window.setInterval(next,2000);
/*当鼠标移入img标签时停止计时器*/
img.onmouseover=stop;
/*移走时开始*/
img.onmouseout=start;

function change(node)
/*获取元素value值计算下标*/
index=node.value-1;
img.src=arr[index];

/*下一张*/
function next()
if(index==arr.length-1)
index=0;
else
index++;

img.src=arr[index];

function up()
if(index==0)
index=arr.length-1
else
index--;

img.src=arr[index];


/*取消定时器*/
function stop()
window.clearInterval(timer)

/*开始定时器*/
function start()
timer=window.setInterval(next,2000)

</script>
</head>

<body>
<img src="img/1.jpg" id="pic">
<input type="button" value="上一张" onClick="up()">
<input type="button" value="1" onClick="change(this)">
<input type="button" value="2" onClick="change(this)">
<input type="button" value="3" onClick="change(this)">
<input type="button" value="4" onClick="change(this)">
<input type="button" value="5" onClick="change(this)">
<input type="button" value="6" onClick="change(this)">
<input type="button" value="7" onClick="change(this)">
<input type="button" value="8" onClick="change(this)">
<input type="button" value="下一张" onClick="next()">
</body>

 

 

一阶段项目的相关知识网站

滚动监听:https://www.jianshu.com/p/4bf613d8c927
jQuery数据库:http://www.jq22.com/
Bootstrap插件(轮播):https://www.runoob.com/bootstrap/bootstrap-carousel-plugin.html
Bootstrap插件下载:https://www.bootcss.com/
jQuery(选择器):https://www.runoob.com/jquery/jquery-selectors.html
jQuery参考手册:http://www.w3school.com.cn/jquery/jquery_ref_selectors.asp

 

以上是关于Java学习13的主要内容,如果未能解决你的问题,请参考以下文章

10/13-10/19 java学习总结(没有课堂的课后学习总结) &实验总结6

《JAVA学习笔记(1---13-4)》

Java学习13(异常)

学习Java的第13天

Java学习13

面向对象程序设计(JAVA) 第13周学习指导及要求