怎样做js图片滚动的效果,越简单越好

JavaScript013

怎样做js图片滚动的效果,越简单越好,第1张

首先准备以下的东西:

1、图片若干,并规范化图片名字。从1开始。

2、在存放图片的文档中新建一个txt。

3、在txt中输入内容。

4、txt后缀改为html,完成

txt的内容:

<script>

var i

function pre()

{

if(i==1)return

i--

document.getElementById("pic").innerHTML="<img src="+i+".jpg></img>"

}

function next()

{

i++

document.getElementById("pic").innerHTML="<img src="+i+".jpg></img>"

}

</script>

<body>

<div onclick="pre()"><</div>

<div id="pic" ><</div>

<div onclick="next()">></div>

</body>

最简单的方法就是把二级菜单的样式设置为:

1:oe_secondary_submenu {display:none}

2:在点击的时候显示二级菜单:

$(".oe_secondary_submenu").data("onShow")=false //一开始状态为隐藏

$(".oe_secondary_menu_section").click(function(){

if($(".oe_secondary_submenu").data("onShow")){ //切换二级菜单的同时改变状态

$(".oe_secondary_submenu").hide()

$(".oe_secondary_submenu").data("onShow",false)

}else{

$(".oe_secondary_submenu").show()

$(".oe_secondary_submenu").data("onShow",true)

}

})

楼主是想要点击合计就是出数值还是什么?如果说点击合计就算出值的话如下

<table width="400" border="1">

    <tr>

     <th rows="5">简易购物车</th>

    </tr>

    <tr>

     <td>商品名称</td>

     <td>数量(件)</td>

     <td>单价(美元)</td>

     <td>运费(美元)</td>

     <td><button onclick="fun()">合计</button></td>

    </tr>

    <tr>

     <td><input type="text" name="goodsName" /></td>

     <td><input type="text" name="num" id="num" /></td>

     <td><input type="text" name="price" id="price" /></td>

     <td><input type="text" name="freight" id="freight" /></td>

     <td><input type="text" name="total" id="total" /></td>

    </tr>

</table>

<script>

function fun(){

var num = document.getElementById("num").value

var price = document.getElementById("price").value

        var freight = parseInt(document.getElementById("freight").value)

        var total = (price * num) + freight

        document.getElementById("total").value = total

}

</script>