0

I have a simple .html page which uses Javascript to display some popups. Now If the Javascript is disabled I want to show some text with anchor links so if javascript is enabled I should be able to show the popups but if Javascript is disabled i want to display some text and popups shouldnt be displayed. I dont want to use is there a way i can do it with HTML, CSS?

Name: <a class="icon_help" href="#hbc_2" title="Prevention, Immunization &amp; Screening">2</a><noscript><a href="" title="">2</a></noscript>

If you see the above statement there is a small icon which is displayed with Javascript but if Javascript is disabled I just want to display the text in anchor tag. But whats happening currently is when Javascript is disabled the text in anchor link is displayed along with the icon I just want the text to be displayed as Javascript is turned off. Thanks

kjkjl
  • 147
  • 1
  • 8

4 Answers4

3

Add a no script clause:

<noscript>
  <a href="blabla1.html">Link 1</a><br />
  <a href="blabla2.html">Link 2</a><br />
  <a href="blabla3.html">Link 3</a>
</noscript>

More info here.

Gert Grenander
  • 16,866
  • 6
  • 40
  • 43
  • 1
    Not really good for what the OP needs IMO (even though he asked for it). I think what is needed here is progressive enhancement. – Pekka May 24 '10 at 21:06
1

Use progressive enhancement:

<a href="/link/to/help/document.html" 
   onclick="do_javascript_stuff(); return false">

(It is considered good form to add the click event to the link in the head part of the document, or in a separate script file, but this will do fine as well.)

This way, if JavaScript is turned off, the user will be taken to the HTML document; otherwise, your JavaScript actions will fire.

Pekka
  • 442,112
  • 142
  • 972
  • 1,088
0

Have javascript to hide the box that contains those links?

baloo
  • 7,635
  • 4
  • 27
  • 35
0

I assume your question is, "how can I show specific content if Javascript is disabled?" You can use the noscript tag.

<noscript>
  <!-- content -->
</noscript>

This will cause browsers that do not support JavaScript to simply ignore this tag, and process what's nested inside it. Browsers that support JavaScript skip this tag if JavaScript is enabled. More examples and full attribute list: http://www.w3schools.com/tags/tag_noscript.asp

I strongly suggest you do not show automatic pop-ups using JavaScript or any other implementation, though.

Propeng
  • 508
  • 2
  • 10