Never been to DZone Snippets before?

Snippets is a public source code repository. Easily build up your personal collection of code snippets, categorize them with tags / keywords, and share them with the world

About this user

Korakot Chaovavanich http://korakot.stumbleupon.com

« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS 

Toggle an element's display

Sometimes you have a content that shouldn't display
by default. You can provide a link to display/hide
that content
   1  
   2  <a href='javascript: toggle()'>toggle</a>
   3  <div id='div1' style='display:none'>
   4  Don't display me
   5  </div>
   6  
   7  <script>
   8  function toggle(){
   9  	var div1 = document.getElementById('div1')
  10  	if (div1.style.display == 'none') {
  11  		div1.style.display = 'block'
  12  	} else {
  13  		div1.style.display = 'none'
  14  	}
  15  }
  16  </script>

Let php show all errors

I have wondered why my php script doesn't show
errors like it did before. It seems my server admin
has default config set not to show the errors.

Here's how to override it.
   1  
   2  error_reporting(E_ALL);
   3  ini_set('display_errors', '1');


BTW, it's really a pain to code in a language that
demand a ';' after every line.
« Newer Snippets
Older Snippets »
Showing 1-2 of 2 total  RSS