document.f1.fsexy.value
改为document.f1.fsexy.options[document.f1.fsexy.selectedIndex].value

解决方案 »

  1.   

    为什么要加document.f1.fsexy.selectedIndex直接的value不是这个控件选中那条的value吗?
      

  2.   

    哦 看错了function showimage() 

    document.f1.fimg.src=eval("face/"+document.f1.fsexy.value+document.f1.fimage.value+".gif"); }
      

  3.   

    改为这样了还是不行document.f1.fimg.src="face/"+document.f1.fsexy.options[document.f1.fsexy.selectedindex].value+document.f1.fimage.options[document.f1.fimage.selectedindex].value+".gif";
      

  4.   

    这样也还是不行:document.f1.fimg.src=eval("face/"+document.f1.fsexy.value+document.f1.fimage.value+".gif");
      

  5.   

    晕了 你把你的html页面代码发给我 我调试下
      

  6.   

    概念错误。在客户端动态加载图片,必须用 http://xxxxxxxxxxxx……因为此时代码已经下载到客户的硬盘上了。@_@
      

  7.   

    代码如下:<!--#include file="conn.asp"-->
    <script language="javascript">
    function check()
    {
    if(document.f1.fname.value=""||document.f1.femail.value=""||document.f1.fweb.value=""||document.f1.fnr.value="")
      {
      alert("请认真填写");
      return false;
      }
    else
      {
      document.f1.submit();
      }
    }function showimage()
    {
    document.f1.fimg.src=eval("face/"+document.f1.fsexy.value+document.f1.fimage.value+".gif");
    document.write(document.f1.fimg.src);
    }
    </script>
    <%
    iuser=request.querystring("user")
    if request.querystring("user")="" or request.querystring="" then
      response.redirect("reg.asp")
    esle
      msql="select * from [user] where [user]='"&iuser&"'"
      set rs=conn.execute(msql)
      if rs.eof and rs.bof then
        rs.close
        set rs=nothing
        conn.close
        set conn=nothing
        response.write("<script>alert('没有此版,请申请');location.href='reg.asp';</script>")
        response.end
      else
        if session("user")=rs("user") and session("pwd")=rs("pwd") then
          power="ok"
        else
          power=""
        end if
      end if   
    end if%>
    <table border=0 width="680" align="center">
    <tr><td>
    <form action="index.asp?user='<%=iuser%>' method="post" name="f1">
      <table border=0 width="100%">
      <tr><td colspan=2>姓名:<input type="text" name="fname" size=20 maxlength=16>&nbsp&nbsp留言性质:<input type="radio" name="fr" value="r1" checked>公开<input type="radio" name="fr" value="r2">悄悄话&nbsp&nbsp
      性别:<select name="fsexy" size=1  onchange="showimage();">
      <option value="m" selected >男</option>
      <option value="w">女</option>
      </select>&nbsp&nbsp
      表情: <select name="fimage" onchange="showimage();">
      <option value="01">头像一</option>
      <option value="02">头像二</option>
      <option value="03">头像三</option>
      </select></td></tr>
      <tr><td width="450">信箱:<input type="text" name="femail" size=25 maxlength=50>&nbsp&nbsp主页:<input type="text" name="fweb" value="http://"></td><td rowspan=2 align="center" width="230"><img id="fimg" name="fimg" src="face/m01.gif"></td></tr>
      <tr><td width="450">内容:<textarea name="fnr" rows="5" cols="53"></textarea></td></tr>
      <tr><td colspan=2 align="center"><input type="button" name="b1" value="提交" onclick="check();">&nbsp&nbsp&nbsp<input type="reset" name="b2" value="重置"></td></tr>
      </table>
    </form>
    </td></tr></table>
      

  8.   

    document.f1.fsexy.options[document.f1.fsexy.selectedIndex].value
      

  9.   

    改为这样了,还是不能行,图片不会换<!--#include file="conn.asp"-->
    <script language="javascript">
    function check()
    {
    if(document.f1.fname.value=""||document.f1.femail.value=""||document.f1.fweb.value=""||document.f1.fnr.value="")
      {
      alert("请认真填写");
      return false;
      }
    else
      {
      document.f1.submit();
      }
    }function showimage()
    {
    document.f1.fimg.src="face/"+document.f1.fsexy.options[document.f1.fsexy.selectedIndex].value+document.f1.fimage.options[document.f1.fimage.selectedIndex].value+".gif";
    }
    </script>
    <%
    iuser=request.querystring("user")
    if request.querystring("user")="" or request.querystring="" then
      response.redirect("reg.asp")
    else
      msql="select * from [user] where [user]='"&iuser&"'"
      set rs=conn.execute(msql)
      if rs.eof and rs.bof then
        rs.close
        set rs=nothing
        conn.close
        set conn=nothing
        response.write("<script>alert('没有此版,请申请');location.href='reg.asp';</script>")
        response.end
      else
        if session("user")=rs("user") and session("pwd")=rs("pwd") then
          power="ok"
        else
          power=""
        end if
      end if   
    end if%>
    <table border=0 width="680" align="center">
    <tr><td>
    <form action="index.asp?user='<%=iuser%>' method="post" name="f1">
      <table border=0 width="100%">
      <tr><td colspan=2>姓名:<input type="text" name="fname" size=20 maxlength=16>&nbsp&nbsp留言性质:<input type="radio" name="fr" value="r1" checked>公开<input type="radio" name="fr" value="r2">悄悄话&nbsp&nbsp
      性别:<select name="fsexy" size=1  onchange="showimage();">
      <option value="m" selected >男</option>
      <option value="w">女</option>
      </select>&nbsp&nbsp
      表情: <select name="fimage" onchange="showimage();">
      <option value="01">头像一</option>
      <option value="02">头像二</option>
      <option value="03">头像三</option>
      </select></td></tr>
      <tr><td width="450">信箱:<input type="text" name="femail" size=25 maxlength=50>&nbsp&nbsp主页:<input type="text" name="fweb" value="http://"></td><td rowspan=2 align="center" width="230"><img name="fimg" src="face/m01.gif"></td></tr>
      <tr><td width="450">内容:<textarea name="fnr" rows="5" cols="53"></textarea></td></tr>
      <tr><td colspan=2 align="center"><input type="button" name="b1" value="提交" onclick="check();">&nbsp&nbsp&nbsp<input type="reset" name="b2" value="重置"></td></tr>
      </table>
    </form>
    </td></tr>
    <tr><td><table width="100%" border=0>
    <tr><td><a href="<%=rs("url")%>" target="_blank"><%=rs("user")%></a>>>留言本>>第页&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp&nbsp<%if power="ok" then%>【<a href="edit.asp?user=<%=rs("user")%>">修改资料</a>】&nbsp【<a href="login.asp?user=<%=rs("user")%>&exit=ok">退出登录</a>】<%else%>【<a href="login.asp?user=<%=rs("user")%>">版主管理</a>】&nbsp【<a href="reg.asp">在线申请</a>】<%end if%>
    </td></tr>
    </table></td></tr>
    </table>