Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/427.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/3/html/79.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 链接两个html页面(java脚本)_Javascript_Html_Uri - Fatal编程技术网

Javascript 链接两个html页面(java脚本)

Javascript 链接两个html页面(java脚本),javascript,html,uri,Javascript,Html,Uri,我有两页。一个是index.html,另一个是pk_canonical.html。我想将pk-canonical.html页面与索引页面链接,作为下拉列表中的选项之一。当我试着运行页面时。这两个页面分别运行良好,但当我从索引页面的下拉列表中选择该选项时,它会说,服务器没有找到任何与请求的URI匹配的内容。并且它不会进入pk_规范页面。请帮助我哪里出了问题。下面是代码 index.html: <div class="content"> <!--<p>-->

我有两页。一个是index.html,另一个是pk_canonical.html。我想将pk-canonical.html页面与索引页面链接,作为下拉列表中的选项之一。当我试着运行页面时。这两个页面分别运行良好,但当我从索引页面的下拉列表中选择该选项时,它会说,服务器没有找到任何与请求的URI匹配的内容。并且它不会进入pk_规范页面。请帮助我哪里出了问题。下面是代码

index.html:

<div class="content">
    <!--<p>-->
        <!--<select data-bind="options: Algorithms,-->
                       <!--optionsText: 'algoName',-->
                       <!--value: selectedAlgorithm,-->
                       <!--optionsCaption: 'Choose...'"></select>-->
    <!--</p>-->

    <!--<div data-bind="visible: selectedAlgorithm"> &lt;!&ndash; Appears when you select something &ndash;&gt;-->
        <!--You have chosen a country with population-->
        <!--<span data-bind="text: selectedAlgorithm ? selectedAlgorithm.algoPage : 'unknown'"></span>.-->
    <!--</div>-->
    <select id="algoSelect" onchange="algoSel(this)">
        <option selected="selected" disabled="disabled">Select an algorithm</option>
        <option value="Nussinov.html">Nussinov - max. #bp structure</option>
        <option value="counting.html">Structure Counting</option>
        <option value="McCaskill.html">McCaskill - structure probabilities</option>
        <option value="MEA.html">MEA structure</option>
        <option value="co-folding.html">Co-folding interactions</option>
        <option value="hybrid-only.html">hybrid-only interactions</option>
        <option value="accessibility.html">accessibility-based interactions</option>
        <option value="pk_canonical.html">canonical pseudoknot</option>


    </select>

    <div id="algopage">

    </div>

    <script type="application/javascript">
        function loadPage(){
            console.log("algo selected:", document.location);
            var $_GET = {};

            document.location.search.replace(/\??(?:([^=]+)=([^&]*)&?)/g, function () {
                function decode(s) {
                    return decodeURIComponent(s.split("+").join(" "));
                }

                $_GET[decode(arguments[1])] = decode(arguments[2]);
            });

//            console.log($_GET['id']);
            $(algopage).load($_GET['id']);
//            console.log("algo loaded");

        };

        function algoSel(algo){
            window.location='index.html?id=' + algo.value;

        };

    </script>

</div>


</body>
pk_canonical.html:

 <div class="row" id="introduction">
   <div class="colW600">
     The algorithm by
     <a href="https://doi.org/10.1093/nar/gkm258">Reeder&Giegerich</a>
     briefly sketch the way to implement  an extension of the usual dynamic programming (DP) scheme for RNA folding [5,6].
     <br />
     Helical stem called 'Canonical stem' which comprises only canonical Watson-Crick base pairs and usually ends with two canonical C=G base pairs before the internal loop.
     C(i,j) =  Maximal length of canonical stem with outermost base pairs (i,j)

     <br />
     A canonical pseudoknot consists of two crossing canonical stems.
     <br />
     The (suboptimal) backtrace procedure the pseudoknot matrix is handled at the end.
     <br />
     <br />
     Here, Since only two helices participate in one pseudoknot, we loop over all possible knots in one O(n4) loop and store the result in a two-dimensional matrix. 
     Finally, the traceback is visualized. 
   </div>
   <div class="colW150">
    <img alt="Canonical pseudoknot" src="output-onlinejpgtools.png" width=120 height=90 >
  </div>
 </div>

用这个替换你的函数

 function algoSel(algo){
     window.location= algo.value;
 };
您好,这个小问题来自于您的algoSelalgo函数,只需将值algo.value分配给window.location即可使其重定向到您的pk_规范算法页面。多谢各位

这里,


,您告诉js重定向到index.html页面并查找名为pk_canonical.html的资源/路径,而不是告诉它只重定向到pk_canonical.html

hi,谢谢您的解决方案。但它仍然不起作用。它说pk_canonical.html“不允许加载”。访问被拒绝。嗨..抱歉..浏览器不支持。现在它可以正常工作了。谢谢实际上,Microsoft edge不支持pk_规范页面,但它支持所有其他html页面。在opera和chrome中,它支持pk_canonical页面,但不支持所有其他页面。由于edge支持所有其他算法,您能否告诉我为什么pk_canonical单独不支持pk_canonical?如何让文件在我自己的本地主机上测试
    function algoSel(algo){
        window.location='index.html?id=' + algo.value;
    }