js/j02random.php
<html>
<head>
<title> <?php echo basename(__file__, '.php'); ?> </title>
<script type="text/javascript">
function randText() {
txt = new Array (4);
txt[0] = 'eins';
txt[1] = 'zweiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiiii ein ei';
txt[2] = 'drei';
txt[3] = 'viertens txt[3] und noch lännnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnnger';
i = Math.floor(Math.random() * txt.length);
document.write('<h2> random text ' + i + '</h2> <p>' + txt[i] + '</p>');
}
function randCol() {
return Math.floor(256 - Math.random() * 100).toString(16) + Math.floor(256 - Math.random() * 100).toString(16) + Math.floor(256 - Math.random() * 100).toString(16);
};
function divRandColor() {
c=randCol();
document.write('<div style="background: #' + c + '"> color=' + c);
}
</script>
<script type="text/javascript">
// divRandColor();
</script>
<style type="text/css">
</style>
</head>
<body>
<script type="text/javascript"> divRandColor(); randText(); </script>
<h1>random text call</h1>
<script type="text/javascript"> divRandColor(); randText(); </script>
</div>
<script type="text/javascript"> divRandColor(); randText(); </script>
in innerem div
</div>
in äusserem div
</div>
<h1>Source <?php echo __file__; ?> </h1>
<?php highlight_file(__file__) ?>
</body>
</html>