Make div (with behaviour like button created with JS) into link if javascript is disabled

StackOverflow https://stackoverflow.com/questions/12745216

  •  05-07-2021
  •  | 
  •  

문제

I have 6 div's that have onclick javascript. When you click them a part of the site changes.

I want these divs to contain links if javascript is disabled. (instead of changing the part of the page link to another page)

How would I do that?

도움이 되었습니까?

해결책

<div>
   <a href="noscript.htm" onclick="window.location='script.htm';return false;">button</a>
</div>

something like this?​ http://jsfiddle.net/C6BJT/

다른 팁

Can't you just use a link in the html and swap it with js when you need it to be a button?

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top