首页 > 编程技术 > html

网站改版了怎么办?

发布时间:2016-9-20 19:02

网站改版了怎么办?很多网站在改版的时候,非常担心用户习惯。

  有的担心是合理的,有的担心是多余的。担心之前,先搞清两个问题:

  首先,你有没有老用户?有多少老用户?如果网站本身就是提供给walk-up-and-use(走来即用)类型的用户的,比如某某博物馆门口的参观指导系统,它完全就是面向新用户的,根本就没有老用户。另外,有的网站本身很烂(可能是产品烂也可能是易用性烂),来看一眼的人就不会再回来,那么随便怎么改都不会有老用户习惯的问题。

  其次,用户使用该网站的频繁程度,如果是一个频发事件,每天、每周、每月都会上去看那么一两次,改版确实要考虑老用户的习惯问题。比如Gmail、豆瓣、MSN、新浪等。
但也有不少网站,尤其是电子商务类网站,用户并不是每月都会上来的,而是到了有需求的时候才上来,比如当当,比如携程,比如PPG。这种网站,用户甚至记不住你的主色调,更不用说你的预订流程有哪些步骤了(能记住你的域名就不错了)。

asp,php,js获取图片大小并控制

本文章讲了二种获取图片的大小,第一种是php ,第二种是js 第三种是asp的,js 获取图片大小然后再用js 改变图片大小,下面我们有例子说明.
php相当简单的,用getimagesize 函数就行了,我们只要对得到的数组进行处理就行了.
<?
$arr=getimagesize("images/album_01.gif");
echo $arr[3];
$strarr=explode("\"",$arr[3]);
echo $strarr[1];
?>
再看看asp获取图片大小并进行缩放的函数

<%
Class ImgWHInfo ’获取图片宽度和高度的类,支持JPG,GIF,PNG,BMP
    Dim ASO
    Private Sub Class_Initialize
        Set ASO=Server.CreateObject("ADODB.Stream")
        ASO.Mode=3
        ASO.Type=1
        ASO.Open
    End Sub
    Private Sub Class_Terminate
        Err.Clear
        Set ASO=Nothing
    End Sub 
 
    Private Function Bin2Str(Bin)
        Dim I, Str
        For I=1 To LenB(Bin)
            clow=MidB(Bin,I,1)
            If ASCB(clow)<128 Then
                Str = Str & Chr(ASCB(clow))
            Else
                I=I+1
                If I <= LenB(Bin) Then Str = Str & Chr(ASCW(MidB(Bin,I,1)&clow))
            End If
        Next
        Bin2Str = Str
    End Function
      
    Private Function Num2Str(Num,Base,Lens)
        Dim Ret
        Ret = ""
        While(Num>=Base)
            Ret = (Num Mod Base) & Ret
            Num = (Num - Num Mod Base)/Base
        Wend
        Num2Str = Right(String(Lens,"0") & Num & Ret,Lens)
    End Function
      
    Private Function Str2Num(Str,Base) 
        Dim Ret,I
        Ret = 0 
        For I=1 To Len(Str) 
            Ret = Ret *base + Cint(Mid(Str,I,1)) 
        Next 
        Str2Num=Ret 
    End Function 
      
    Private Function BinVal(Bin) 
        Dim Ret,I
        Ret = 0 
        For I = LenB(Bin) To 1 Step -1 
            Ret = Ret *256 + AscB(MidB(Bin,I,1)) 
        Next 
        BinVal=Ret 
    End Function 
      
    Private Function BinVal2(Bin) 
        Dim Ret,I
        Ret = 0 
        For I = 1 To LenB(Bin) 
            Ret = Ret *256 + AscB(MidB(Bin,I,1)) 
        Next 
        BinVal2=Ret 
    End Function 
      
    Private Function GetImageSize(filespec)
        Dim bFlag
        Dim Ret(3) 
        ASO.LoadFromFile(filespec) 
        bFlag=ASO.Read(3) 
        Select Case Hex(binVal(bFlag)) 
        Case "4E5089": 
            ASO.Read(15) 
            ret(0)="PNG" 
            ret(1)=BinVal2(ASO.Read(2)) 
            ASO.Read(2) 
            ret(2)=BinVal2(ASO.Read(2)) 
        Case "464947": 
            ASO.read(3) 
            ret(0)="gif" 
            ret(1)=BinVal(ASO.Read(2)) 
            ret(2)=BinVal(ASO.Read(2)) 
        Case "535746": 
            ASO.read(5) 
            binData=ASO.Read(1) 
            sConv=Num2Str(ascb(binData),2 ,8) 
            nBits=Str2Num(left(sConv,5),2) 
            sConv=mid(sConv,6) 
            While(len(sConv)<nBits*4) 
                binData=ASO.Read(1) 
                sConv=sConv&Num2Str(AscB(binData),2 ,8) 
            Wend 
            ret(0)="SWF" 
            ret(1)=Int(Abs(Str2Num(Mid(sConv,1*nBits+1,nBits),2)-Str2Num(Mid(sConv,0*nBits+1,nBits),2))/20) 
            ret(2)=Int(Abs(Str2Num(Mid(sConv,3*nBits+1,nBits),2)-Str2Num(Mid(sConv,2*nBits+1,nBits),2))/20) 
        Case "FFD8FF": 
            Do  
            Do: p1=binVal(ASO.Read(1)): Loop While p1=255 And Not ASO.EOS 
            If p1>191 And p1<196 Then Exit Do Else ASO.read(binval2(ASO.Read(2))-2) 
            Do:p1=binVal(ASO.Read(1)):Loop While p1<255 And Not ASO.EOS 
            Loop While True 
            ASO.Read(3) 
            ret(0)="JPG" 
            ret(2)=binval2(ASO.Read(2)) 
            ret(1)=binval2(ASO.Read(2)) 
        Case Else: 
            If left(Bin2Str(bFlag),2)="BM" Then 
                ASO.Read(15) 
                ret(0)="BMP" 
                ret(1)=binval(ASO.Read(4)) 
                ret(2)=binval(ASO.Read(4)) 
            Else 
                    ret(0)="" 
            End If 
        End Select 
        ret(3)="width=""" & ret(1) &""" height=""" & ret(2) &"""" 
        getimagesize=ret 
    End Function 
      
    Public Function imgW(IMGPath)
        Dim FSO,IMGFile,FileExt,Arr
        Set FSO = Server.CreateObject("Scripting.FileSystemObject") 
        If (FSO.FileExists(IMGPath)) Then 
            Set IMGFile = FSO.GetFile(IMGPath) 
            FileExt=FSO.GetExtensionName(IMGPath) 
            Select Case FileExt 
                Case "gif","bmp","jpg","png": 
                Arr=GetImageSize(IMGFile.Path) 
                imgW = Arr(1) 
            End Select 
            Set IMGFile=Nothing 
        Else
            imgW = 0
        End If     
        Set FSO=Nothing 
    End Function 
     
    Public Function imgH(IMGPath)
        Dim FSO,IMGFile,FileExt,Arr
        Set FSO = server.CreateObject("Scripting.FileSystemObject") 
        If (FSO.FileExists(IMGPath)) Then 
            Set IMGFile = FSO.GetFile(IMGPath) 
            FileExt=FSO.GetExtensionName(IMGPath) 
            Select Case FileExt 
                Case "gif","bmp","jpg","png": 
                Arr=getImageSize(IMGFile.Path) 
                imgH = Arr(2) 
            End Select 
            Set IMGFile=Nothing 
        Else
            imgH = 0 
        End If     
        Set FSO=Nothing 
    End Function 
End Class
IMGPath="Test.jpg"
Set PP = New ImgWHInfo  
W = PP.imgW(Server.Mappath(IMGPath))  
H = PP.imgH(Server.Mappath(IMGPath)) 
Set pp = Nothing 
 
Response.Write("<img" width=100% src=’"&IMGPath&"’ border=0><br>宽:"&W&";高:"&H)
%>

下面是js获取图片大小并控制大小的例子.
<HTML>
<HEAD>
<TITLE>演示图片等比例缩小</TITLE>
<script>
function Wa_SetImgAutoSize(img)
{
//var img=document.all.img1;//获取图片
var MaxWidth=200;//设置图片宽度界限
var MaxHeight=100;//设置图片高度界限
var HeightWidth=img.offsetHeight/img.offsetWidth;//设置高宽比
var WidthHeight=img.offsetWidth/img.offsetHeight;//设置宽高比
alert("test"+img.offsetHeight+img.fileSize);
if(img.offsetHeight>1) alert(img.offsetHeight);
if(img.readyState!="complete"){
 return false;//确保图片完全加载
}

if(img.offsetWidth>MaxWidth){
img.width=MaxWidth;
img.height=MaxWidth*HeightWidth;
}
if(img.offsetHeight>MaxHeight){
img.height=MaxHeight;
img.width=MaxHeight*WidthHeight;
}
}

function CheckImg(img)
{
 var message="";
 var MaxWidth=1;//设置图片宽度界限
 var MaxHeight=1;//设置图片高度界限
 
 if(img.readyState!="complete"){
  return false;//确保图片完全加载
 }
 if(img.offsetHeight>MaxHeight) message+="\r高度超额:"+img.offsetHeight;
 if(img.offsetWidth>MaxWidth) message+="\r宽度超额:"+img.offsetWidth;
 if(message!="") alert(message);
}
</script>
</HEAD>
<BODY>
<img" width=100% src="images/frequency.gif" border=0 id="img1" onload="CheckImg(this);">
<br>
<input id=inp type="file" onpropertychange="img1.src=this.value;">
</BODY>
</HTML>

<!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" lang="zh-CN">
<head>
<title>图片垂直居中</title>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<style type="text/css" media="all">
div,img{margin: 0;padding: 0;border: 0;}#content{width: 303px;height: 404px;background: #F63;color: #000;font: 12px Arial,Helvetica,sans-serif;position: relative;}#content[id]{display: table;position: static;}#middle{position: absolute;left: 0;top: 50%;}#middle[id]{display: table-cell;vertical-align: middle;position: static;}#inner{position: relative;left: 0;top: -50%;}
</style>
</head>
<body>
<div id="content">
<div id="middle">
<div id="inner">垂直居中<br />
<img" width=100% src="http://www.111cn/images/logo.gif" _fcksavedurl="http://www.111cn/images/logo.gif" alt="网页教学网logo" title="网页教学网logo" /></div>
</div>
</div>
</body>
</html>

加clear空div

.clearfix:after {
content: "."; display: block;
height: 0;
clear: both;
visibility: hidden;}
.clearfix {display: inline-block;}
/* Hides from IE-mac \*/
* html .clearfix {height: 1%;}
.clearfix {display: block;}/* End hide from IE-mac */
.clearfix {
display: block;
margin: 0px;
clear: both;
padding: 0px;
visibility: hidden;
background-color:#666666;
border:0px none #FFFFFF;
}
.clearfix:after { height: 1px;}

使用方法:

在所有浮动层之后加上这个层

<div class="clearfix"></div>

2.把背景层加浮动,但是这个方法会影响其他的div,有时候好用。

3.加 overlow 这个也有问题,会影响div的外观。

文本超过div 自动换行代码文本自动换行IE中解决方法:

word-wrap:break-word;
word-break:break-all;
注:在要换行的内容相应的单元格或者DIV里加入,如:

<div style=word-wrap:break-word;></div>或<td style=word-wrap:break-word;></td>
文本自动换行FireFox中解决方法(脚本):

<script type="text/javascript">
function toBreakWord(intLen, id){
var obj=document.getElementById(id);
var strContent=obj.innerHTML;
var strTemp="";
while(strContent.length>intLen){
strTemp+=strContent.substr(0,intLen)+"<br>";
strContent=strContent.substr(intLen,strContent.length);
}
strTemp+= strContent;
obj.innerHTML=strTemp;
}
</script>
注:以上脚本放在</head>前面.

调用时如下写法:

同个页面单处调用:

<div id="content">这里是要应用换行的内容</div><script language="javascript">toBreakWord(60, "content");</script>
同个页面多处调用:

<div id="content">这里是要应用换行的内容</div><script language="javascript">toBreakWord(60, "content");</script>
<div id="content2">这里是要应用换行的内容</div><script language="javascript">toBreakWord(60, "content2");</script>
注:把应用的JS写在</div>后面,其中60表示一行要显示多少字字符,注意多个调用时ID的相应变化,不能同一个ID名称,应用上面的方法后IE也会是按设定的字符数换行,但是IE里面支持自动换行,所以只要判断一下是否为IE,如果不是IE就不要输出上面的

<script language="javascript">toBreakWord(60, "content");</script>
这段JS,如果不是就要输出。

标签:[!--infotagslink--]

您可能感兴趣的文章: