Hello There, Guest! Login Register
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5

[Web Dev] clippy-js?

#11
Answer to my question:

<script type="text/javascript">
clippy.load('Merlin', function(agent) {
// Do anything with the loaded agent
agent.show();
agent.play('Wave');
agent.speak(' <?php
$content = trim(file_get_contents('quotes.txt'));
$quotes = explode("\n", $content);
echo $quotes[rand(0, count($quotes)-1)];
?>');
agent.play('LookLeft');
});
</script>
 Reply
#12
someone knows how to do an infinite loop that writes the random quote, waits 30 seconds and writes another?
 Reply
#13
<code>

<script type="text/javascript">
clippy.load('Merlin', function(agent) {
// Do anything with the loaded agent
agent.show();
agent.play('Wave');
setInterval(function() {
agent.speak(' <?php
$content = trim(file_get_contents('quotes.txt'));
$quotes = explode("\n", $content);
echo $quotes[rand(0, count($quotes)-1)];
?>');
// Do something every 30 seconds
}, 30000);
agent.play('LookLeft');
});
</script>

</code>

This should do it, but is NOT tested. setInterval is standard javascript.

http://forum.jquery.com/topic/jquery-set...l-function
CompTIA A+ 602 Certified
Cisco Certified Entry Network Technician (Expired)
Google Developer Expert for Web Technology
 Reply
#14
Thanks Garbee.
It almost works. The only problem is that repeats the same thing over and over :_(
 Reply
#15
In that case it needs to be done from within PHP as well, a little out of my zone there.
CompTIA A+ 602 Certified
Cisco Certified Entry Network Technician (Expired)
Google Developer Expert for Web Technology
 Reply
 
Forum Jump:

Users browsing this thread: 1 Guest(s)