用户操作
[即时聊天] [发私信] [加为好友]
流氓蚊子ID:zhanghongwen
1148次访问,排名2万外好友6人,关注者13
zhanghongwen的文章
原创 4 篇
翻译 0 篇
转载 0 篇
评论 24 篇
最近评论
文章分类
    收藏
    相册
    视频照.
    存档
    软件项目交易
    订阅我的博客
    XML聚合  FeedSky
    订阅到鲜果
    订阅到Google
    订阅到抓虾
    订阅到BlogLines
    订阅到Yahoo
    订阅到GouGou
    订阅到飞鸽
    订阅到Rojo
    订阅到newsgator
    订阅到netvibes

    原创 JS调用数据库内容二级联动收藏

     | 旧一篇: 数据库操作通用代码!

    <!--#include Virtual ="/include/DBConn.asp"-->
    <!--#include Virtual ="/include/Isenter.asp"-->
    <%
    NewsID=trim(request("Id"))
    NewsID=replace(NewsID,"'","")

    Sort_Id=trim(request("Sort_Id"))
    Sort_Id=replace(Sort_Id,"'","")

    set objRS = fSelect("Web_News","*","Id="&NewsID&"")
    if objRS.eof then
    %>
    <script language=javascript>
         history.back();
         alert("ID号传送错误!");
    </script>
    <%
    Response.End
    end if

    set bigClassrs = fSelect("Web_Sort","ID,[Name]","Lm_key=1") 
    set SmallClassrs = fSelect("Web_Sort","ParentID,[Name],ID","Lm_key=2")
    FirstID=""
    FirstID=bigClassrs(0)
    %>
    <html>
    <head>
    <meta http-equiv="Content-Language" content="zh-cn">
    <meta http-equiv="Content-Type" content="text/html; charset=gb2312">
    <link href="css/bodystyle.css" rel="stylesheet" type="text/css">
    <style type="text/css">
    <!--
    body,td,th {
     font-size: 12px;
    }
    body {
     margin-left: 0px;
     margin-top: 0px;
     margin-right: 0px;
     margin-bottom: 0px;
    }
    -->
    </style>
    <link href="/webadmin/admin_main.css" rel="stylesheet" type="text/css">
    <script language="javascript">
     function on_submit()
     {//验证数据的合法性   
     
     if (form1.smallclassID.value == "" || form1.smallclassID.value == "0")
        {
         alert("请选择您要二级栏目!");
         form1.smallclassID.focus();
         return false;
        }
       
        if (form1.Title.value == "")
        {
         alert("新闻标题不能为空!");
         form1.Title.focus();
         return false;
        }
       
        if (form1.Remark.value == "")
        {
         alert("关键字不能为空!");
         form1.Remark.focus();
         return false;
        } 
     change();    
     return true; 
    }
    function change()
    {
    document.getElementById("bigclassname").value = document.getElementById("bigClassID").options[document.getElementById("bigClassID").selectedIndex].text;
    document.getElementById("smallclassname").value = document.getElementById("SmallClassID").options[document.getElementById("SmallClassID").selectedIndex].text;
    }
    </script>
    </head>
    <body>
    <form name="form1" method="POST" action="ModifyNews3.asp" onSubmit="return on_submit()">
    <table width="90%" border="0" align=center cellpadding="0" cellspacing="0">
      <tr>
        <td colspan="3"><b>修改新闻
          <input name="ID" type="hidden" id="ID" value="<%=NewsID%>">
          <input name="Sort_Id" type="hidden" id="Sort_Id" value="<%=Sort_Id%>">
        </b></td>
      </tr>
      <tr>
        <td colspan="3">
          <hr size="1">    </td>
      </tr>
      <tr>
        <td width="134" align="right">所属大类:</td>
        <td colspan="2">
       <%
          str=""
          str="<select name=""bigclassID"" class=""textbox"" id=""bigclassname"" onChange=redirect(this.options.value)>"  
          bigClassrs.movefirst
       if bigClassrs.eof then
          str=str&"<option value=""0"">没有类别设置</option>"
       else
         do until bigClassrs.eof 
          str=str&"<option value="&bigClassrs(0)&">"&bigClassrs(1)&"</option>"
          bigClassrs.movenext
         loop 
             str=str&"</select>" 
       end if
       response.Write(str)
      
      set bigClass = fSelect("VIEW_sort","ID,ParentID,Name,ParentName","Id="&Sort_Id&"")
      response.write("【"&bigClass(3)&"】")  
      
        %>
       <input name="bigclassname" type="hidden" value="<%=bigClass(3)%>">
        <%
        str=""
        str=str&"&nbsp;&nbsp;所属小类:<select name=""smallclassID"" class=""textbox"" id=""smallclassID"">"
           str=str&"<option value=""0"">请选择所属小类</option>"
      if FirstID<>"" then
          set SmallClassname = fSelect("Web_Sort","ParentID,[Name],ID","Lm_key=2 and ParentID="&FirstID&"")
       do until SmallClassname.eof
     
       str=str&"<option value="&SmallClassname(2)&">"&SmallClassname(1)&"</option>"  
       SmallClassname.movenext
       loop
       SmallClassname.close
       end if 
       str=str&"</select>"
       response.Write(str)
       %>
          <%response.write("【"&bigClass(2)&"】")%>
          <input name="smallclassname" type="hidden" value="<%=bigClass(2)%>"></td>
      </tr>
      <tr>
        <td width="134" align="right">新闻标题:</td>
        <td colspan="2"><input name="Title" type="text" class="textbox" value="<%response.write(objRS("Title"))%>" size="56"></td>
      </tr>
        <tr>
        <td width="134" align="right">是否显示:</td>
        <td width="186"><input name="is_show" type="radio" value="1" <%If objRS("Dis_Tag")=1 Then Response.Write("checked=checked")%>>
          是&nbsp;&nbsp;&nbsp;
            <input name="is_show" type="radio" value="0" <%If objRS("Dis_Tag")=0 Then Response.Write("checked=checked")%>>
          否</td>
        <td width="547">是否推荐:
          <input name="is_commend" type="radio" value="1" <%if objRS("Commend")=1 then response.write("checked=checked")%>>
    是&nbsp;&nbsp;&nbsp;
    <input type="radio" name="is_commend" value="0" <%if objRS("Commend")=0 then response.write("checked=checked")%>>
    否</td>
        </tr>
      <tr>
        <td width="134" align="right">关键字:</td>
        <td colspan="2"><input name="Remark" type="text" class="textbox" id="Remark" value="<%response.write(objRS("Remark"))%>" size="56"></td>
      </tr>

      <tr>
        <td width="134" align="right">作者:</td>
        <td colspan="2"><input name="Author" type="text" class="textbox" value="<%response.write(objRS("Author"))%>" size="20"></td>
      </tr>
      <tr>
        <td width="134" align="right">来源:</td>
        <td colspan="2"><input name="Source" type="text" class="textbox" id="Source" value="<%response.write(objRS("Source"))%>" size="20"></td>
      </tr>
      <tr>
        <td valign="top" width="134" align="right">新闻内容:</td>
        <td colspan="2"><textarea name="Content" style="display:none"><%response.write(objRS("Content"))%></textarea>
        <iframe src="webedit/ewebeditor.asp?id=Content&style=webedit" width="600" HEIGHT="350" scrolling="no" frameborder="0" class="textboxLINE_1" ID="eWebEditor1"></iframe> </td>
      </tr>
      <tr>
        <td width="134"></td>
        <td colspan="2"></td>
      </tr>
      <tr>
        <td colspan=3><hr size=1></td>
      </tr>
      <tr>
        <td colspan="3" align="center"><input name="B1" type="submit" class="Bbutton" value=" 修改&gt;&gt; ">
          &nbsp;&nbsp;
          <input name="Submit" type="reset" class="Bbutton" value="  重置&gt;&gt;">
          &nbsp;&nbsp;</td>
      </tr>
    </table>
    <%
    bigClass.close
    objRS.close
    %>
    </form>
    <script>
    <!--
    var temp=document.form1.smallclassID
    function redirect(x)
    {
    var i
    i=0
    for (var m=temp.options.length-1;m>0;m--)
    temp.options[m]=null
    <%
    while not SmallClassrs.eof
    %>
    cnt=<%=SmallClassrs(0)%>
    if(cnt==x)
    {
    temp.options[i]=new Option("<%=SmallClassrs(1)%>","<%=SmallClassrs(2)%>")
    i=i+1}
    else
    {
    temp.options[i]=null
    }
    <%
    SmallClassrs.movenext
    wend
    %>
    }
    //-->
    </script>
    </body>
    </html> 

    发表于 @ 2006年08月23日 17:15:00|评论(loading...)|编辑

     | 旧一篇: 数据库操作通用代码!

    评论:没有评论。

    发表评论  


    当前用户设置只有注册用户才能发表评论。如果你没有登录,请点击登录
    Csdn Blog version 3.1a
    Copyright © 流氓蚊子