黑马程序员技术交流社区

标题: 为什么ie中对div的style赋值不了 [打印本页]

作者: 我要学    时间: 2016-9-4 10:36
标题: 为什么ie中对div的style赋值不了
我想实现两个button随我滑轮滚动而滚动,在火狐中能可是使用,但在ie中则不行,这是为什么啊
[Java] 纯文本查看 复制代码
<%@ page language="java" import="java.util.*" pageEncoding="UTF-8"%>
<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core" %>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">

<html>
        <head>
                <title>回复留言</title>
                <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
                <meta name="description" content="留言本">
                <link href="img/1/jd100.css" rel="stylesheet" type="text/css">
                <script src="script/myjs3.js"></script>
                <script type="text/javascript">
                        var x = 0;
                        window.onscroll = function(){
                                var div = document.getElementById("diid");
                                var d = document.getElementById("did");
                                var top = div.offsetTop;
                                var sctop = document.body.scrollTop;
                                var height = (top+document.body.scrollTop-x)+"px;";
                                div.style = "position: absolute;right: 60px;top: "+height ;
                                d.style = "position: absolute;left: 60px;top:"+height;
                                x = sctop;
                        };
                </script>
        </head>
       
        <body background=img/1/bookbg.gif leftmargin='0' topmargin='3' marginwidth='0' marginheight='0'>
                <div align='center'>
                        <IMG src=img/1/welcome.jpg>
                </div>
                <!--   留言信息显示    开始 -->
                <div align='center'>
                        <table width='750' border='0' cellspacing='1' cellpadding='4' align='center'>
                                <tr>
                                        <td height='20' colspan='2' class='unnamed2'>
                                                <marquee onMouseOut=start(); onMouseOver=stop(); scrollamount=3>
                                                        <b><font color=#000099>欢迎您使用&nbsp;留言本&nbsp;</font> </b>
                                                </marquee>
                                        </td>
                                </tr>
                                <tr>
                                        <td height='20' class='unnamed1'>
                                                主题:
                                                ${topic}
                                        </td>
                                        <td height='20' class='unnamed1' align='right'></td>
                                </tr>
                        </table>
                       
                        <div align='center' style='width=750'>
                                <div align='left'>
                                        <table width='%' height='20' border='0' cellpadding='0'
                                                cellspacing='0'>
                                                <tr>
                                                        <td width='11' background='img/1/titlemu_1.gif'></td>
                                                        <td width='*' background='img/1/titlemu_2.gif'>
                                                                <div align='center' style="position: absolute;left: 60px;top:300px;" id="did" >
                                                                        <a href='messageBoard.jsp' class=jdmenu><b>留言</b></a>
                                                                </div>
                                                        </td>
                                                        <td width='12' background='img/1/titlemu_3.gif'></td>
                                                       
                                                </tr>
                                        </table>
                                </div>
                        </div>
                       
                        <TABLE width='750' border=0 align='center' cellPadding=0 cellSpacing=0 borderColor=#111111 style='BORDER-COLLAPSE: collapse'>
                                <TBODY>
                                        <TR>
                                                <TD width='2%'>
                                                        <IMG src='img/1/T_left.gif' border=0>
                                                </TD>
                                                <TD width='96%' background='img/1/Tt_bg.gif'></TD>
                                                <TD width='2%'>
                                                        <IMG src='img/1/T_right.gif' border=0>
                                                </TD>
                                        </TR>
                                </TBODY>
                        </TABLE>
                        <TABLE width='750' border=1 align=center cellPadding=0 cellSpacing=0 class='jd_tab' style='border-collapse:collapse'>
                                <tr>
                                        <td height='150' valign='top' class='jd_tab'>
                                                <table width='100%' height='20' border='0' cellpadding='0'
                                                        cellspacing='0'
                                                        style='table-layout:fixed;word-break:break-all;word-wrap:break-word;'>
                                                        <tr>
                                                                <td style='word-break:break-all' class=jd_title>
                                                                        &nbsp; ※&nbsp;
                                                                        <b>
                                                                        <input type="hidden" name="tname" id="inid" value="${topic}"/>${topic}
                                                                        <input type="hidden" name="name" id="inid2" value="${sessionScope.e.ename}"/>
                                                                        <input type="hidden" name="wname" id="inid3" value="${wno}"/>
                                                                        </b>
                                                                </td>
                                                        </tr>
                                                </table>
                                                <table width='100%' border='0' cellpadding='3' style='table-layout:fixed;word-break:break-all;word-wrap:break-word;'>
                                                        <tr>
                                                                <td width='' style='word-break:break-all'>
                                                                        <div class=unnamed2>
                                                                                ${msg}
                                                                        </div>
                                                                        <div class=unnamed2 style="bottom: 0px;">
                                                                                <input type="button" value="回复" onclick="showDiv()"/>
                                                                        </div>
                                                                </td>
                                                        </tr>
                                                </table>
                                        </td>
                                </tr>
                                <tr>
                                        <td height='18' valign='bottom' class='jd_tab'
                                                style='font-size: 12px;' align="right">
                                                <font color=#666666>${pname}&nbsp;&nbsp;&nbsp;&nbsp;写于${msgdate}&nbsp;
                                                        &nbsp;</font>
                                        </td>
                                </tr>
                        </table>


                        <TABLE width='750' border=0 align='center' cellPadding=0
                                cellSpacing=0 style='BORDER-COLLAPSE:collapse'>
                                <TBODY>
                                        <TR>
                                                <TD>
                                                        <IMG src='img/1/T_bottomleft.gif' border=0>
                                                </TD>
                                                <TD width='100%' background='img/1/T_bottombg.gif'></TD>
                                                <TD>
                                                        <IMG src='img/1/T_bottomright.gif' border=0>
                                                </TD>
                                        </TR>
                                </TBODY>
                        </TABLE>


                        <table width='750' border='0' cellspacing='1' cellpadding='4'
                                align='center'>
                                <tr>
                                        <td width='' height='20' align='right' class='unnamed1'></td>
                                </tr>
                        </table>
                        <!-- 留言显示  结束 -->
                        <!-- 回复   开始 -->
                        <TABLE width='750' border=0 align='center' cellPadding=0 cellSpacing=0>
                                <TR>
                                        <TD height=5 align="left" class='unnamed1'>
                                                回复内容:
                                        </TD>
                                </TR>
                        </TABLE>
                       
                        <TABLE width='750' border=0 align='center' cellPadding=0 cellSpacing=0 borderColor=#111111 style='BORDER-COLLAPSE: collapse'>
                                <TBODY>
                                        <TR>
                                                <TD width='2%'>
                                                        <IMG src='img/1/T_left.gif' border=0>
                                                </TD>
                                                <TD width='96%' background='img/1/Tt_bg.gif'></TD>
                                                <TD width='2%'>
                                                        <IMG src='img/1/T_right.gif' border=0>
                                                </TD>
                                        </TR>
                                </TBODY>
                        </TABLE>
                       
                        <c:forEach items="${wlist}" var="w">
                                <TABLE width='750' border=1 align=center cellPadding=0 cellSpacing=0 class='jd_tab' style='border-collapse:collapse'>
                                        <tr>
                                                <td height='150' valign='top' class='jd_tab'>
                                                        <table width='100%' border='0' cellpadding='3'
                                                                style='table-layout:fixed;word-break:break-all;word-wrap:break-word;'>
                                                                <tr>
                                                                        <td width='' style='word-break:break-all'>
                                                                                <div class=unnamed2>
                                                                                        ${w.msg}&nbsp;
                                                                                </div>
                                                                                <%--
                                                                                <div class=unnamed2 style="bottom: 0px;">
                                                                                        <input type="button" value="回复" onclick="showDiv()"/>
                                                                                </div>
                                                                                --%>
                                                                        </td>
                                                                </tr>
                                                        </table>
                                                </td>
                                        </tr>
                                        <tr>
                                                <td height='18' valign='bottom' class='jd_tab'
                                                        style='font-size: 12px;' align="right">
                                                        <font color=#666666>&nbsp;${w.pname}&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;写于${w.msgdate}&nbsp;</font>
                                                </td>
                                        </tr>
                                </table>
                        </c:forEach>
                        <TABLE width='750' border=0 align='center' cellPadding=0 cellSpacing=0 style='BORDER-COLLAPSE:collapse'>
                                <TBODY>
                                        <TR>
                                                <TD>
                                                        <IMG src='img/1/T_bottomleft.gif' border=0>
                                                </TD>
                                                <TD width='100%' background='img/1/T_bottombg.gif'></TD>
                                                <TD>
                                                        <IMG src='img/1/T_bottomright.gif' border=0>
                                                </TD>
                                        </TR>
                                </TBODY>
                        </TABLE>

                        <!-- 回复  结束    -->
                        <table width='750' border='0' cellspacing='1' cellpadding='4'
                                align='center'>
                                <tr>
                                        <td width='' height='20' align='right' class='unnamed1'></td>
                                </tr>
                        </table>
                       
                        <div id="did1" style="display: none">
                       
                        <TABLE width='750' height=0 border=1 align=center cellPadding=0 cellSpacing=0 class='jd_tab' style='border-collapse:collapse'>
                                <TBODY>
                                        <TR>
                                                <TD height=25 class=jd_titlemu>
                                                        <div align='center'>
                                                                <strong>快 速 回 复 </strong>
                                                        </div>
                                                </TD>
                                        </TR>
                                        <TR>
                                                <TD align=middle valign='top'>
                                                <a name="bottom"></a>
                                                <form name='form' method='post' id="fid">
                                                        <table width='100%' border='0' align='center' cellpadding='1'
                                                                cellspacing='1' class='unnamed1'>
                                                                <tr>
                                                                        <td align='right' valign='top'>
                                                                                内容:<span><font color="grey">(字数不得超过600)</font></span>
                                                                        </td>
                                                                        <td>
                                                                                <textarea name='content' cols='80' rows='6' class='input1' id="teid" onblur="checkSize(1)" onfocus="checkUser()"></textarea>
                                                                                <br>
                                                                                &nbsp;&nbsp;
                                                                                <input type='button' name='Submit' value='提 交 ' onclick="wordsSub()">
                                                                                &nbsp;
                                                                                        <br>
                                                                                </td>
                                                                        </tr>
                                                                </table>
                                                                </form>
                                                        </TD>
                                                </TR>
                                        </TBODY>
                                </TABLE>
                        </div>
                </div>
                <br>
                        <div style="position: absolute;top: 300px;right: 60px" id="diid">
                                <a href="#top"><input type="button" value="回到顶部"/></a>
                        </div>
        </body>
</html>





欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2