<-- Terug naar Snippets

Random commentaar in afbeelding (update na klik)

PHP versie: n.v.t

Javascript: MooTools Framework

Vlinder

Comment, comment, comment....

Broncode


Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 100

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 106

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 112

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 119

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 120

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 121

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 199

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 287

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 288

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 289

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 290

Deprecated: preg_replace(): The /e modifier is deprecated, use preg_replace_callback instead in /home/jorendew/phphulp/inc/class.ubb.php on line 291
Code
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
<?php
ini_set
('display_errors''On');
error_reporting(E_ALL);

?>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
    <title>PHPtuts.nl - PHP Snippets - Random commentaar in afbeelding (update na klik)</title>
    
    <link rel="stylesheet" href="../../styles/default.css" type="text/css" media="screen" />
    <link rel="stylesheet" href="../../styles/ubb.css" type="text/css" media="screen" />
    
    <style type="text/css">
    #image {
        margin: 10px 0px 5px 10px;
    }
    #comment {
        position: absolute;
        width: 633px;
        margin-left: 15px;
        background-color: #fff;
        filter:alpha(opacity=70);
        -moz-opacity:.70;
        opacity:.70;
    }
    #comment p {
        padding: 0px;
        margin: 5px;
    }
    #comment a {
        cursor: pointer;
    }
    #mask {
        margin-left: 10px;
        position: absolute;
        width: 635px;
        height: 20px;
        background-color: #fff;
    }
    </style>
    
    <script type="text/javascript" src="../../inc/mootools.js"></script>
    <script type="text/javascript">
    var currentKey = 0;
        
    function changeComment()
    {
        var aComments = [
            'Comments, comments, comments...', 
            'Voorbeeld commentaar', 
            'Nog meer commentaar',
            'Kun je nog meer commentaar bedenken?',
            'Random commentaar 1',
            'Random commentaar 2'
        ];
        
        var fx = new Fx.Styles($('comment'), 
        {
            duration: 500, 
            wait: false
        });
        
        fx.set({'margin-top' : 0});
        
        $('comment').innerHTML = '<p>' + aComments[currentKey] + ' <a id="next">Volgende</a></p>';
        $('next').addEvent('click', function ()
        {
            currentKey += 1;
            if(!aComments[currentKey])
            {
                currentKey = 0;
            }
            
            changeComment();
        });
        
        fx.start({'margin-top' : -35});        
    }
    
    window.addEvent('domready', function()
    {
        changeComment();
    });
    </script>
</head>
<body>
    <div id="wrap">
        <p class="none small align-right"><a href="/codeSnippets/">&lt;-- Terug naar Snippets</a></p>
        <h1>Random commentaar in afbeelding (update na klik)</h1>
        <div id="info">
            <p>PHP versie: n.v.t</p>
            <p>Javascript: <a href="http://www.mootools.net" target="_blank">MooTools Framework</a></p>
        </div>
        
        <div id="image">
            <img src="images/vlinder.jpg" alt="Vlinder" />
        </div>
        <div id="comment"><p>Comment, comment, comment....</p></div>
        <div id="mask"></div>
                
        <?php        
        
// Weergeven broncode
        
define('FILE'__FILE__);
        require_once(
'../broncode.php');
        
?>
    </div>    

<!-- Google analytics (geen onderdeel van script) -->
<script type="text/javascript" src="/inc/ga1.js"></script>
<script type="text/javascript" src="/inc/ga2.js"></script>

</body>
</html>