Javascript?
Thread Starter
PassionFord Post Troll



Joined: Aug 2004
Posts: 3,499
Likes: 184
From: Colchester,essex
Any javascript pro's in the house?
I need to create a very basic "choices" page.
The skeleton code
Now i've written basic times tables script as a seperate entity but how the hell do i intcorporate it to the above
If someone can just show me how it is written into the function then i can sort the rest out. Just need to work out one
I need to create a very basic "choices" page.
The skeleton code
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
"http://www.w3.org/TR/html4/loose.dtd">
<html lang="en">
<head>
<style>
body{font-family: Arial,sans-serif; background-color: #86bfc9;}
#content{float:right; width: 75%;}
</style>
<script type = "text/javascript">
function showit(what,where)
{
var node = document.getElementById(where);
while( node.firstChild )
node.removeChild( node.firstChild );
node.appendChild( document.createTextNode(what) );
}
function hello()
{
alert("Hello World");
}
function timestable()
{
str="you code times table here";
showit(str,"Results");
}
function formattedtimestable()
{
str="you code formatted times table here";
showit(str,"Results");
}
function alerttimestable()
{
str="you code alert times table here";
// you code here
alert(str);
}
</script>
</head>
<body>
<h1>JavaScript Exercises </h1>
<div id="content"> <div id = "Results"></div> </div>
<a href="#" OnClick = "hello()">Hello Alert</a> <br/><br/>
<a href="#" OnClick = "timestable()">Times Tables</a> <br/><br/>
<a href="#" OnClick = "alerttimestable()">Times table in an alert box</a>
<br/><br/>
<a href="#" OnClick = "formattedtimestable()">Times Tables in a Table</a>
<br/><br/>
</body>
</html>
Code:
<html>
<body>
<table>
<?php
$values = range(1,12); // same as $values = array(1,2,3,4,5,6,7,8,9,10);
foreach($values as $side){ // Creates each row
echo '<tr>';
foreach ($values as $top){ // Creates each column
$output = $side * $top; // multiplies the top value times the side value
echo "<td>$output</td>";
}
echo '</tr>';
}
?>
</table>
</body>
</html>
Thread
Thread Starter
Forum
Replies
Last Post
TIFF
Pictures, video & Photoshop Forum
43
Mar 10, 2011 01:30 PM



