function func1(a){
    document.formname.hiddenName.value=a;
}

解决方案 »

  1.   

    我的意思是在add_news.jsp中有一个在线编辑器,然后有上传图片的功能,点击上传图片就会弹出一个对话框,那里通过edit.js控制,我想在edit.js那里对add_new.jsp中的hidden变量pictures赋值,请问如何做到呢,谢谢
      

  2.   

    <%
    String strname="你想要的值";
    %>
    <script language=javascript>
    function func1(){
        document.formname.hiddenName.value=<%=strname%>;
    }
    </script>
      

  3.   

    <script language=javascript>
    function changeDrop2() 
    {
    if (document.form1.Drop1.options[document.form1.Drop1.selectedIndex].value ==  "选择板块") with(document.form1.Drop2){
    length = 1;
    selectedIndex = 0
    options[0].text = '无';
    options[0].value = '无';
    }
    <%set rs1=server.createobject("adodb.recordset")
    sql1="select * from fbk order by shijian asc" 
    rs1.open sql1,conn,1,3
    for i=1 to rs1.recordcount %>
      if (document.form1.Drop1.options[document.form1.Drop1.selectedIndex].value == "<%=rs1("name")%>") with(document.form1.Drop2){ 
      <% set rs2=server.createobject("adodb.recordset")
    sql2="select * from fzbk where cid='"&rs1("id")&"'" 
    rs2.open sql2,conn,1,3
    if rs2.bof and rs2.eof then rs2count=1 else rs2count=rs2.recordcount end if %>
      length = <%=rs2count%>; 
      selectedIndex = 0 ; 
      <%if rs2.recordcount>1 then 
      for e=1 to rs2.recordcount 
      response.write "options["&e-1&"].text='"&rs2("name")&"';"
      response.write "options["&e-1&"].value='"&rs2("name")&"';"
      rs2.movenext
      next
      else
      response.write"options[0].text = '无';"
      response.write"options[0].value = '无';"
      end if 
      rs2.close
      set rs2=nothing %>
    }
    <%rs1.movenext 
    if rs1.eof then exit for   
    next 
    rs1.close
    set rs1=nothing %>
    }
    </script>
      

  4.   

    我的JS是在另一个文件里面的,我试过用
    var aa;//aa未某个值
    document.form1.pictures.value=aa;
    add_news.jsp提交后并没有对hidden的Content赋值,请问这是什么原因呢?
      

  5.   

    add_news.jsp提交后?...提交后还回到add_news.jsp吗?
    如果还回到add_news.jsp,
    var aa;//aa未某个值
    document.form1.pictures.value=aa;
    要是在<body onload="func1()">
     function func1(){
    var aa;//aa未某个值
    document.form1.pictures.value=aa;}中才行,
    如果不回到这个页面,当然不会给他伏值了
      

  6.   

    上面可能是我理解有问题;
    var aa;//aa未某个值
    document.form1.pictures.value=aa;
    add_news.jsp提交后并没有对hidden的Content赋值?
    <input type=hidden name="pictures"> 
    document.form1.pictures.value=aa; //hidden的pictures赋值
    <input type=hidden name="Content">
    document.form1.Content.value=aa; //hidden的Content赋值
      

  7.   

    谢谢你的帮助,但是我在edit.js文件使用你的代码并没有对add_news.jsp中的pictures赋值,请问是什么原因呢?
      

  8.   

    你怎么使用的,alert("1111");
    var aa;//aa未某个值
    document.form1.pictures.value=aa;
    alert("222");加上上面的,如果出来,说明付值了,如果没出来,说明没调用
      

  9.   

    终于成功了,原来我用了JSPSMARTUPLOAD,在另一页却用了request.getparameter(),所以获取不了pictures,还是要谢谢各位的帮助,特别是mingxuan3000(铭轩),分数马上送上