zoukankan      html  css  js  c++  java
  • 使用JS提交刷新本页

    这个问题是我在使用JS刷新页面时遇见的
    我就是想在使用JS完成操作后,再PageLoad下页面,使我的后台代码能够顺利执行
    ASPX页的代码如下,后台不需要任何代码,如果想看效果
    在PageLoad里加个断点就可以了  你就可以看见每次PageLoad了
     


    <%@ Page Language="C#" AutoEventWireup="true"  CodeFile="Default.aspx.cs" Inherits="_Default" %>

    <!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" >
    <head runat="server">
        
    <title>无标题页</title>
    </head>
    <body>
    <script language="javascript" type ="text/javascript">
    //Load信息(生成XML文件)
    function pageLoad()
    {
         
    //给TextBox1设置一个焦点
         document.getElementById('TextBox1').focus();
         
    //利用提交请求刷新页面(无刷新的)
         httpobj=new ActiveXObject("Microsoft.XMLHTTP");
         tempfile
    ="Default.aspx?ok=false";
         httpobj.open(
    "post",tempfile,false);
         httpobj.send();
        
    }


    </script>


        
    <form id="form1" runat="server">
        
    <div>
        
            
    <asp:TextBox ID="TextBox1" runat="server" AutoPostBack="False"
                Style
    ="position: relative"></asp:TextBox>
                
            
    <input id="Button1" style="position: relative" type="button" value="button" onclick="pageLoad();return false;" />
           
    </div>
           
           
            
        
    </form>
    </body>
    </html>
  • 相关阅读:
    【转】当你输入一个网址的时候,实际会发生什么?
    opencv 操作本地摄像头实现录像
    谷歌笔试题——排序,只允许0和其他元素交换
    判断素数的相关代码
    VS2010 代码自动对齐 快捷键
    谷歌的一道面试题
    各种排序算法代码汇总
    冒泡排序
    lua环境变量
    lua迭代
  • 原文地址:https://www.cnblogs.com/bnjbl/p/879286.html
Copyright © 2011-2022 走看看