Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/377.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181

Warning: file_get_contents(/data/phpspider/zhask/data//catemap/1/php/296.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript Can';无法在同一选项卡上加载url_Javascript_Php_Html_Url_Dom - Fatal编程技术网

Javascript Can';无法在同一选项卡上加载url

Javascript Can';无法在同一选项卡上加载url,javascript,php,html,url,dom,Javascript,Php,Html,Url,Dom,我知道解决这个问题的方法,但这是错误的方法,包括创建一个新文件和简单的欺骗 现在的问题是: 我有一个包含index.html文件的文件夹;此文件有一个菜单,其中包含一个 在reg_interlocator.html中,我使用div,在其中一个中,我将注册表称为: 这会将form_regito_interlocator.html文件的内容插入到div中,并将用户插入的数据发送到名为php的文件夹中的文件reg_interlocator.php 在这个文件reg_interlocator.php

我知道解决这个问题的方法,但这是错误的方法,包括创建一个新文件和简单的欺骗

现在的问题是:

  • 我有一个包含index.html文件的文件夹;此文件有一个菜单,其中包含一个
  • 在reg_interlocator.html中,我使用div,在其中一个中,我将注册表称为:

  • 这会将form_regito_interlocator.html文件的内容插入到div中,并将用户插入的数据发送到名为php的文件夹中的文件reg_interlocator.php

  • 在这个文件reg_interlocator.php中,当我使用的数据出现问题时

    echo "<script>alert('blablabla.'); window.location = '../index.html';</script>";
    
    echo“警报('blabla');window.location='../index.html';”;
    
  • 但如果一切正常,我想重新加载index.html。
    问题是浏览器在我从第2步开始使用的同一个div中重新加载index.html

    实际上,选项卡url保持不变:localhost/proj/reg_interlocator.html自第2步起的每一步

    我已经使用了:

    header('window-target: main');
    header('location:../index.html');
    
    <script>top.window.location='../index.html';</script>
    window.open("http://localhost/proj/index.html","_self");
    
    header('window-target:main');
    标题('location:../index.html');
    top.window.location='../index.html';
    窗口打开(“http://localhost/proj/index.html","你自己",;
    

    有人能帮我吗?我知道我的代码卡在div上,这就是为什么索引文件在该div内打开的原因。

    您最好使用PHP(而不是HTML)包含外部HTML文件,而不是直接在HTML中这样做。PHP可以将外部HTML文件注入到最终输出中,这会产生比让用户的web浏览器获取其他HTML文件(创建第二个请求)更清晰的结果。这还可以解决将html加载到
    标记而不是整个页面中的问题。

    问题是我使用Css3Menu创建菜单,但它只允许在html文件中插入菜单。。。我可能很容易解决这个问题,困扰我的是不知道如何解决上面的问题。一定有办法,我想知道,因为这一直困扰着我。