<%
c = " Hello, M JavsScript!"
%>
<script type="text/javascript">
function myFunction()
{
return ("<%=Replace(c,"""","\""")%>");
}
</script>

解决方案 »

  1.   

    或者是<script type="text/javascript">
    function myFunction()
    {
    alert("Hello, M JavsScript!");
    }
    </script>
    <%
    '我想实现的效果是:c="Hello, M JavsScript!"
    response.write c
    %>
    我如何能在页面上得到alert 弹出窗口里的内容?多谢
      

  2.   


    谢谢,这种方式不能满足我的需要,我必须是把js里的内容取到asp部分,而不是先在asp定义好了后再被js调用
      

  3.   

    还是要递交表单,可以借助隐藏的iframe<iframe name="hf" width="0" height="0">
    <form action="xx.asp" name="form1" target="hf">
      <input type="hiden" name="c">
    </form>
    <script>
    function myFunction()
    {
      return "Hello, M JavsScript!"
    }
    function show(s){
      alert(s)
    }
    function dosubmit(){
      document.form1.c.value = myFunction();
      document.form1.submit()
    }
    </script>---------
    xx.asp
    <%
    c = request("c")
    .....存入数据库
    %>
    <script>
    parent.show("ok"); //将返回的数值传给原窗口
    location.replace("about:blank");
    </script>
      

  4.   

    恩,多谢hookee ,这种方式是可以的,但是还有没有其他的方法呢?
      

  5.   

    还是要递交表单,可以借助隐藏的iframe <iframe name="hf" width="0" height="0"> 
    <form action="xx.asp" name="form1" target="hf"> 
       <input type="hiden" name="c"> 
    </form> 
    <script> 
    function myFunction() 

      return "Hello, M JavsScript!" 

    function show(s){ 
      alert(s) 

    function dosubmit(){ 
      document.form1.c.value = myFunction(); 
      document.form1.submit() 

    </script> --------- 
    xx.asp 
    <% 
    c = request("c") 
    .....存入数据库 
    %> 
    <script> 
    parent.show("ok"); //将返回的数值传给原窗口 
    location.replace("about:blank"); 
    </script>哪位帮我看看这代码里面哪错了,我运行不了,谢谢
      

  6.   

    运行的时候提示 document.form1.c' 为空或不是对象 是什么原因呢?