如何将这个php-part转换为javascript函数。
<li><a href="<?php if($path) {echo '/index.php#products';}else{echo 'javascript:void';} ?>" onclick="smoothScroll('products');">PRODUCTS</a></li>
答案 0 :(得分:0)
(window.location.pathname + window.location.hash) == 'index.php#products' ? 'index.php#products' : 'javascript.void'