Adding an onclick function to go to url in JavaScript?

前端 未结 9 1260
北荒
北荒 2020-11-29 18:28

I am using this fancy little JavaScript to highlight a field as the user hovers over it. Could you please tell me if there is a way of adding an onclick functio

9条回答
  •  一向
    一向 (楼主)
    2020-11-29 18:58

    try

    location = url;
    

    function url() {
        location = 'https://example.com';
    }
    
    
    

提交回复
热议问题