Computers, Consoles and I.T. Post all computer related chat in here for our I.T techies to help with. Please be aware that any discussions related to piracy will be removed and render the member liable to a possible ban. Piracy renders PassionFord Admin liable for prosecution, as well as its members.

Javascript?

Thread Tools
 
Search this Thread
 
Old Mar 6, 2012 | 07:21 PM
  #1  
haz87's Avatar
haz87
Thread Starter
PassionFord Post Troll
20 Year Member
Liked
Loved
 
Joined: Aug 2004
Posts: 3,499
Likes: 184
From: Colchester,essex
Default Javascript?

Any javascript pro's in the house?

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>
Now i've written basic times tables script as a seperate entity but how the hell do i intcorporate it to the above

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>
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
Reply
Old Mar 13, 2012 | 09:43 PM
  #2  
haz87's Avatar
haz87
Thread Starter
PassionFord Post Troll
20 Year Member
Liked
Loved
 
Joined: Aug 2004
Posts: 3,499
Likes: 184
From: Colchester,essex
Default

Nobody got a clue?
Reply
Related Topics
Thread
Thread Starter
Forum
Replies
Last Post
TIFF
Pictures, video & Photoshop Forum
43
Mar 10, 2011 01:30 PM
scoooby slayer
Ford RS Cosworth Parts for Sale
2
Jul 2, 2009 07:38 PM
C14KEE
Cars for Sale
15
Sep 20, 2007 05:15 PM
ianshad6
Pictures, video & Photoshop Forum
4
Jan 11, 2007 06:38 PM
winged horse
General Car Related Discussion.
69
Sep 9, 2006 05:32 PM




All times are GMT. The time now is 06:58 AM.