将javascript链接转换为href

将javascript链接转换为href,javascript,onclick,Javascript,Onclick,我想将此提交按钮转换为href链接。表单不是html表单,而是JavaScript。按钮代码当前为: <input type="submit" value="Name" onclick="Offer();"> 如何将其转换为href链接 我试过onclick=“document.Offer();”,但它不能像这样工作 <a href="www.mysite.com" onclick="return theFunction();">Name</a> &l

我想将此提交按钮转换为
href
链接。表单不是html表单,而是JavaScript。按钮代码当前为:

<input type="submit" value="Name" onclick="Offer();">

如何将其转换为
href
链接

我试过
onclick=“document.Offer();”
,但它不能像这样工作

<a href="www.mysite.com" onclick="return theFunction();">Name</a>

<script type="text/javascript">
    function theFunction () {
        // return true or false, depending on whether you want to allow the `href` property to follow through or not
    }
</script>

函数函数(){
//返回true或false,具体取决于是否允许`href`属性继续执行
}

如果可以,请提供您的代码,以便更容易理解您的需求

这上面有一篇帖子,请查看。

什么是“将其转换为a href链接”?我不明白你想做什么。