js关闭当前页面跳转新页面
页面代码:
1 <p class="info"><span style="font-weight: bold">所属项目:</span> 2 @foreach($programList as $task) 3 @if($taskList->project == $task->id ) 4 <span onclick="xiangmu({{$task->id}})" style="color: #3c8dbc;font-family: SimSun;cursor: pointer">{{$task->name}}</span> 5 @endif 6 @endforeach 7 </p>
其中,cursor: pointer,鼠标经过箭头变为小手
1 <script> 2 function xiangmu(id) 3 { 4 5 window.open('{{url('taskDetail')}}'+'/'+id); //跳转 6 window.history.back(-1); //返回上一页面 7 8 } 9 </script>
效果:js关闭当前页面跳转新页面