Progressive enhancement and smooth degradation of javascript

  • 2020-03-29 23:41:37
  • OfStack

How to implement this function like Google?

<script type="text/javascript">
 function displayMenu() {
    //Display navigation list;
 <a href=" The target page " onclick="displayMenu(); return false;"> More and more »</a>

Explanation: displayMenu() is a function that displays a navigation list (omitting its implementation because that's not what we're talking about)
Onclick specifies the click event for the link.
Return false: cancels the default behavior of the browser (so that displayMenu() is executed without the page jumping).

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "">
<html xmlns="">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title> Another way to open a link in a new window </title>
<script type="text/javascript">
function popup(url) {; }
    <li><a href="" onclick="popup(this.href); return false;"> baidu </a></li>
    <li><a href="" onclick="popup(this.href); return false;">google</a></li>

Related articles: