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