正式迁移博客

此站用于个人测试使用,正体请转liunian.info

Posted in 随行札记 | Tagged | 评论关闭

Code Snippet测试

jQuery

   1: $("a").mouseover(function(e){
   2:         var text = $(this).text();
   3:         var link = this.href;
   4:         if (($(this).attr('title')) != "") {
   5:             var mytitle = this.title;
   6:             $(this).removeAttr('title')
   7:         }
   8:       //if (link.length > 30) link = link.toString().substring(0,30);
   9:         var tooltip = "<div id='tooltip'>"+text+"<em>"+link+"</em>"+"</div>";
  10:         $('body').append(tooltip);
  11:         $('#tooltip').css({"opacity":"0.8","top" :( e.pageY+20)+"px","left" :( e.pageX+10)+"px"})
  12:                     .show('fast');})
  13:                     .mouseout(function(){$(this).attr('title') = mytitle; $('#tooltip').remove();})
  14:                     .mousemove(function(e){$('#tooltip')
  15:                     .css({"top" :( e.pageY+20)+"px","left" :( e.pageX+10)+"px"});
  16:     });

PHP

   1: function display_items_per_page()
   2:     {
   3:         $items = '';
   4:         $ipp_array = array(10,25,50,100,'All');
   5:         foreach($ipp_array as $ipp_opt) $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";
   6:         return "<span class=\"paginate\">Items per page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page=1&ipp='+this[this.selectedIndex].value+'$this->querystring';return false\">$items</select>\n";
   7:     }
   8:
   9:     function display_jump_menu()
  10:     {
  11:         for($i=1;$i< =$this->num_pages;$i++)
  12:         {
  13:             $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";
  14:         }
  15:         return "<span class=\"paginate\">Page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page$this->querystring';return false\">$option</select>\n";
  16:     }
  17:
  18:     function display_pages()
  19:     {
  20:         return $this->return;
  21:     }

Posted in 未分类 | 评论关闭

CodeColorer测试

Java

1
System.out.println("test");

C++

1
2
3
4
5
6
#include <stdio .h>
int main( int argc, char *argv[] )
{
    printf( "Hello World!\n" );
    return 0;
}

PHP

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
function display_items_per_page()
    {
        $items = '';
        $ipp_array = array(10,25,50,100,'All');
        foreach($ipp_array as $ipp_opt) $items .= ($ipp_opt == $this->items_per_page) ? "<option selected value=\"$ipp_opt\">$ipp_opt</option>\n":"<option value=\"$ipp_opt\">$ipp_opt</option>\n";
        return "<span class=\"paginate\">Items per page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page=1&ipp='+this[this.selectedIndex].value+'$this->querystring';return false\">$items</select>\n";
    }

    function display_jump_menu()
    {
        for($i=1;$i< =$this->num_pages;$i++)
        {
            $option .= ($i==$this->current_page) ? "<option value=\"$i\" selected>$i</option>\n":"<option value=\"$i\">$i</option>\n";
        }
        return "<span class=\"paginate\">Page:</span><select class=\"paginate\" onchange=\"window.location='$_SERVER[PHP_SELF]?page='+this[this.selectedIndex].value+'&ipp=$this->items_per_page$this->querystring';return false\">$option</select>\n";
    }

    function display_pages()
    {
        return $this->return;
    }

Continue reading

Posted in 未分类 | 评论关闭