Button 如何使用javascript在同一窗口中打开网页

Button 如何使用javascript在同一窗口中打开网页,button,mobile,Button,Mobile,这是带有“转到移动站点”按钮的网页的脚本。当点击按钮时,我希望它转到移动站点 <!DOCTYPE html> <html> <head> <script type="text/javascript"> function goMobile() { window.open("mobile.dudamobile.com/site/syedasadiq"); } </script> </head>

这是带有“转到移动站点”按钮的网页的脚本。当点击按钮时,我希望它转到移动站点

<!DOCTYPE html>
<html>
<head>
  <script type="text/javascript">
    function goMobile() {
      window.open("mobile.dudamobile.com/site/syedasadiq");
    }
  </script>
</head>
<body>
  <input type="submit" value="Go to mobile site" onclick="goMobile()" />
</body>
</html>

函数goMobile(){
window.open(“mobile.dudamobile.com/site/syedasadiq”);
}
我确信我做的一切都是正确的,但当我单击浏览器上的按钮时,会显示一条错误消息:“找不到…”:/Users/abdurasheed/Desktop/mobile.dudamobil…确保路径或Internet地址正确。”

我想电脑是将我的手机URL注册为一个文件,而不是一个网址,但我不确定。不管怎样,我如何解决这个问题


提前感谢。

使用
window.location.href=”http://mobile.dudamobile.com/site/syedasadiq“

@user2627595很高兴它有帮助!如果可以,不要忘记接受:)