How to create an HTML button that acts like a link?

后端 未结 30 3688
长发绾君心
长发绾君心 2020-11-21 04:18

I would like to create an HTML button that acts like a link. So, when you click the button, it redirects to a page. I would like it to be as accessible as possible.

30条回答
  •  广开言路
    2020-11-21 04:57

    7 Ways to do that:

    1. Using window.location.href = 'URL'
    2. Using window.location.replace('URL')
    3. Using window.location = 'URL'
    4. Using window.open('URL')
    5. Using window.location.assign('URL')
    6. Using HTML form
    7. Using HTML anchor tag

    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    
    

提交回复
热议问题