当前位置:编程学习 > C#/ASP.NET >>

asp.net图片错位,在线等。。。。。


<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="Index.aspx.cs" Inherits="Site.Index" %>
<%@ Register TagPrefix="PCS" TagName="UserCHead" Src="~/Head.ascx" %>
<%@ Register TagPrefix="PCS" TagName="UserCFoot" Src="~/Foot.ascx" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head id="Head1" runat="server">
    <title>测试</title>
    <script type="text/javascript" language="javascript">
        function AddFavorite() {
            var aUrls = document.URL.split("/");
            var vDomainName = "http://" + aUrls[2] + "/";
            var description = document.title;
            try {//IE
                window.external.addFavorite(vDomainName, description);
            } catch (e) {//FF
                window.sidebar.addPanel(description, vDomainName, "");
            }
        }
    </script>

    <link href="Style/Web.css" rel="stylesheet" type="text/css" />
</head>
<body bgcolor="#FFFFFF" style="margin:0px;" >
    <form id="form1" runat="server">
    <div align="center">
        <table border="0" cellpadding="0" cellspacing="0" width="1003">
           <tr>
                <td>
                    <PCS:UserCHead ID="Head11" runat="server" />
                </td>
            </tr>



<%@ Control Language="C#" AutoEventWireup="true" CodeBehind="Head.ascx.cs" Inherits="Site.Head"
    ClassName="Head" %>
<%@ Import Namespace="System.ComponentModel" %>
<style type="text/css">
    <!
    -- .STYLE3
    {
        font-family: "黑体";
        font-size: 12px;
    }
    -- ></style>
<script type="text/javascript" language="javascript">
    function AddFavorite() {
        var aUrls = document.URL.split("/");
        var vDomainName = "http://" + aUrls[2] + "/";
        var description = document.title;
        try {//IE
            window.external.addFavorite(vDomainName, description);
        } catch (e) {//FF
            window.sidebar.addPanel(description, vDomainName, "");
        }
    }
</script>
<div>
    <table id="__01" width="1003" height="175" border="0" cellpadding="0" cellspacing="0">
        <tr>
            <td width="3">
            </td>
            <td width="41">
            </td>
            <td width="107">
            </td>
            <td width="141">
            </td>
            <td width="37">
            </td>
            <td width="104">
            </td>
            <td width="142">
            </td>
            <td width="142">
            </td>
            <td width="8">
            </td>
            <td width="134">
            </td>
            <td width="14">
            </td>
            <td width="4">
            </td>
            <td width="29">
            </td>
            <td width="94">
            </td>
            <td width="3">
            </td>
            <td>
            </td>
        </tr>
        <tr>
            <td rowspan="9">
                <img src="../Images/Head1_01.gif" width="3" height="175" alt="" />
            </td>
            <td colspan="13">
                <img src="../Images/Head1_02.gif" width="997" height="30" alt="" />
            </td>
            <td rowspan="9">
                <img src="../Images/Head1_03.gif" width="3" height="175" alt="" />
            </td>
            <td height="30">
            </td>
        </tr>
        <tr>
            <td rowspan="5">
                <img src="../Images/Head1_04.gif" width="41" height="78" alt="" />
            </td>
            <td colspan="3" rowspan="5">
                <img src="../Images/Head1_05.gif" width="285" height="78" alt="" />
            </td>
            <td colspan="4">
                <img src="../Images/Head1_06.gif" width="396" height="14" alt="" />
            </td>
            <td colspan="5" rowspan="2" align="left">
                <span class="STYLE3"><a href="../AboutUs/AboutUsDetail.aspx?CategoryId=5">联系我们</a> |
                    <a href="#" onclick="AddFavorite();">加入收藏</a> | <a onclick="this.style.behavior='url(#default#homepage)';this.setHomePage('http://www.baidu.com');"
                        href="#">设为主页</a></span>
            </td>
            <td height="14">
            </td>
        </tr>
        <tr>
            <td colspan="4" rowspan="4">
                <img src="../Images/Head1_08.gif" width="396" height="64" alt="" />
            </td>
            <td height="20">
            </td>
        </tr>
        <tr>
            <td colspan="5">
                <img src="../Images/Head1_09.gif" width="275" height="11" alt="" />
            </td>
            <td height="11">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <asp:TextBox ID="txtSearch" runat="server" Height="16px" Width="135px"></asp:TextBox>
            </td>
            <td rowspan="2">
                <img src="../Images/Head1_11.gif" width="4" height="33" alt="" />
            </td>
            <td>
                <asp:ImageButton ID="ibtSearch" runat="server" ImageUrl="/Images/Head1_12.gif" OnClick="ibtSearch_Click"
                    Width="28px" />
            </td>
            <td rowspan="2">
                <img src="../Images/Head1_13.gif" width="94" height="33" alt="" />
            </td>
            <td height="23">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <img src="../Images/Head1_14.gif" width="148" height="10" alt="" />
            </td>
            <td>
                <img src="../Images/Head1_15.gif" width="29" height="10" alt="" />
            </td>
            <td height="10">
            </td>
        </tr>
        <tr>
            <td colspan="13">
                <img src="../Images/Head1_16.gif" width="997" height="24" alt="" />
            </td>
            <td height="24">
            </td>
        </tr>
        <tr>
            <td colspan="2">
                <img src="../Images/Head1_17.gif" width="148" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../Index.aspx')" alt="" />
            </td>
            <td>
                <img src="../Images/Head1_18.gif" width="141" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../ProductCenter/ProductList.aspx?CategoryId=48')"
                    alt="" />
            </td>
            <td colspan="2">
                <img src="../Images/Head1_19.gif" width="141" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../Technology/TechnologyList.aspx')" alt="" />
            </td>
            <td>
                <img src="../Images/Head1_20.gif" width="142" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../SoftwareOEM/SoftWareList.aspx?CategoryId=34')"
                    alt="" />
            </td>
            <td>
                <img src="../Images/Head1_21.gif" width="142" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../EducationAndTraining/EducationList.aspx?CategoryId=40')"
                    alt="" />
            </td>
            <td colspan="2">
                <img src="../Images/Head1_22.gif" width="142" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../Partner/PartnerList.aspx?CategoryId=44')"
                    alt="" />
            </td>
            <td colspan="4">
                <img src="../Images/Head1_23.gif" width="141" height="38" style="cursor: pointer;"
                    onclick="javascript:window.navigate('../AboutUs/AboutUsDetail.aspx?CategoryId=6')"
                    alt="" />
            </td>
            <td height="38">
            </td>
        </tr>
        <tr>
            <td colspan="13">
                <img src="../Images/Head1_24.gif" width="997" height="5" alt="" />
            </td>
            <td height="5">
            </td>
        </tr>
    </table>
</div>


上面一个是首页table的内容代码我就没全部拷贝过来了,下面一个是首页里面所引用的用户控件。
现在问题是我在本机调的时候没问题(xp系统,17寸频)。用一台Windows7的宽屏电脑用IE浏览器看的时候,head区就图片错位了,整个布局都变了。  但后来用谷歌浏览器看又没问题。
我想问下怎么解决。  急 !! --------------------编程问答-------------------- 题目是有点长。希望大家能帮忙看看啊。 --------------------编程问答-------------------- 每列的宽带都设定一下 别默认 --------------------编程问答-------------------- width="141" height="38"

这种代码就是这样
你可以把他们设置成百分比 试一下,让他自动适应呢? --------------------编程问答-------------------- css问题,导致不同浏览器可能不同效果 --------------------编程问答--------------------
引用 3 楼 wxr0323 的回复:
width="141" height="38"

这种代码就是这样
你可以把他们设置成百分比 试一下,让他自动适应呢?


这个是美工设定好了的,我一改就页面的布局都会变化。 --------------------编程问答-------------------- 设置宽高百分比 --------------------编程问答-------------------- 最外层要在DIV或TABLE中加入width --------------------编程问答-------------------- 不同版本的ie解释不同吧
你用ietest试试看呗 --------------------编程问答-------------------- --------------------编程问答-------------------- 因为你所用的两台机子的分辨率不同哦
解决办法有二种:
              一、你可以把两台机子的分辨率调为相同
              二是你把代码的width设为百分比 --------------------编程问答-------------------- 因为你现在Table宽度已设定死了,所以在不同分辨率的机子下运行就会错位 --------------------编程问答-------------------- css 兼容性,通过客户端的分辨率显示
补充:.NET技术 ,  ASP.NET
CopyRight © 2022 站长资源库 编程知识问答 zzzyk.com All Rights Reserved
部分文章来自网络,