Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/428.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 使用modal打开新选项卡,并重定向laravel项目中的旧页面_Javascript_Html_Laravel - Fatal编程技术网

Javascript 使用modal打开新选项卡,并重定向laravel项目中的旧页面

Javascript 使用modal打开新选项卡,并重定向laravel项目中的旧页面,javascript,html,laravel,Javascript,Html,Laravel,我正在尝试在我的laravel项目中使用一个标记,用modal打开新选项卡,并将旧选项卡重定向到另一个页面 我尝试了许多解决这个问题的方法,但没有得到结果 解决办法之一是 <a onclick="window.open('https://www.w3schools.com');" data-toggle="modal" data-target="#Mymodal{{$question->id}}">Open Modal</a> 我在控制器中添加了新的

我正在尝试在我的laravel项目中使用一个标记,用modal打开新选项卡,并将旧选项卡重定向到另一个页面

我尝试了许多解决这个问题的方法,但没有得到结果 解决办法之一是

  <a onclick="window.open('https://www.w3schools.com');" data-toggle="modal" data-target="#Mymodal{{$question->id}}">Open Modal</a>   

我在控制器中添加了新的函数,用jquery代码打开页面以加载该模式

<script>
     $(window).load(function(){        
       $('#Mymodal{{$question->id}}').modal('show');

        }); 
</script>

$(窗口).load(函数(){
$('Mymodal{{$question->id}}').modal('show');
}); 
我仍然无法重定向旧选项卡

//html
//html
<a id="click" href="www.abc.com" target="_blank"></a>  //link to open in new tab


//script
{
  $("#click").click();
  window.location.replace("http://stackoverflow.com"); // link to redirect the current tab
}

//链接以在新选项卡中打开 //剧本 { $(“#单击”)。单击(); window.location.replace(“http://stackoverflow.com“”;//链接以重定向当前选项卡 }
//html
<a id="click" href="www.abc.com" target="_blank"></a>  //link to open in new tab


//script
{
  $("#click").click();
  window.location.replace("http://stackoverflow.com"); // link to redirect the current tab
}