tom mcbain
Javascript DOM
0 Answer(s)      2 years and a month ago
Posted in : JavaScript Questions

I'm getting into client-side scripting using javascript.

I am attempting to build a football team fixture application. The user would able to enter the number and name of the teams and then applicaion would generate a fixture list. I was knocking about using DOM techniques but with minimal success. I used  a nested for loop for generating the fixture list but it's not would I'd like. I would like to generate the fixtures on a weekly basis.

I've included code for anyone to view and offer advice.

The following code is the HTML page.

<!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"><!-- InstanceBegin template="/Templates/footballTemp.dwt" codeOutsideHTMLIsLocked="false" -->

<head>

<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />

<!-- InstanceBeginEditable name="doctitle" -->

<title>Star Football</title>

<script language="javascript" type="text/javascript" src="selectTeamNo.js">

</script>



<!-- InstanceEndEditable -->

<!-- InstanceBeginEditable name="head" --><!-- InstanceEndEditable -->

<link href="styles.css" rel="stylesheet" type="text/css" />

</head>



<body>



  <div id="logo">

    <img src="images/starfootball.png" alt="starFootballlogo" width="453" height="105" />

  </div>



<div id="menu"><a href="home.html">Home</a> | <a href="sponsorship.html">Sponsorship</a> | <a href="news.html">News</a> | <a href="weather.html">Weather</a><a href="#"></a> |  <a href="blogger.html">Blogger</a> | </div>

<div id="content"><!-- InstanceBeginEditable name="content" -->



<div id = "heading">Star Football League</div><br /><br />

     <div id = form1>   <form name="form1">

            <table width="380">

  <tr>

                    <td colspan="2" align="left"><b>Input Team</b>

                      <b>&nbsp;:</b>

                  <td width="276">

                <input type="text" name="name"/>                </tr>

                <tr>

                    <td width="82" align="right">

                  <td width="33">

              <td width="276">                </tr>

                <tr>

                    <td width="82" align="right">

                  <td width="33">

                  <td width="276">

                <input type="button" Value="Submit Team" 

                     onclick="insert(this.form.name.value),show();"/>

                <input type="button" Value="Fixtures" 

                     onclick="insert(this.form.name.value),show2();"/>

                    </tr>

            </table>

        </form>

        </div>

        <table width="561" height="62" border="2" bordercolor="#FFFFFF">

  <tr><td width="181" height="54" align="left" valign="top"> <div id="myDiv"></div></td>

  <td width="169"><div id="myDiv2"></div></td></tr></table>

<!-- InstanceEndEditable --></div>

<div id="footer">Copyright 2010 starfootball.com</div>

</body>

<!-- InstanceEnd --></html>

**//This is the javascript code I used from an external file**

var array = new Array();
   //Create new method/fuction
            function insert(val){
                array[array.length]=val;
            }
            function show() {
                var string="<b>These are the chosen teams :</b><br>";
                j = 8
    for(i = 0; i < 8; i++) {
                    string =string+array[i]+"<br>";
                }
                if(array.length > 0)
                 document.getElementById('myDiv').innerHTML = string  ;

            }



    var hometeam = new Array();
    var awayteam = new Array();
    function show2() 
       {
        var string
        hometeam = array
        awayteam = array
                var string2="<tr><td><b>Fixtures :</b><br></td></tr>";
                for(i = 0; i < 8; i++) {
     for(j = 1+i; j < 8; j++) {
      string2 =string2+hometeam[i]+" &nbsp;&nbsp; vs &nbsp;&nbsp;" +hometeam[j]+"  "+"<br>";
     }
                }


     if(hometeam.length > 0)
                 document.getElementById('myDiv2').innerHTML = string2  ;

            }
View Answers









Related Pages:
Javascript DOM
Javascript DOM  I'm getting into client-side scripting using javascript. I am attempting to build a football team fixture application. The user... generate a fixture list. I was knocking about using DOM techniques but with minimal
javascript dom error-message
javascript dom error-message  javascript dom error-message
DOM
DOM  hello, What is DOM?   hii, DOM is stands for Document object Model. DOM is an interface-oriented Application Programming Interface. We can use it for navigation of the entire document
DOM
DOM  package name for Document class?   Hi Friend, The package is known as dom api. For more information, visit the following links: http://www.roseindia.net/xml/ http://www.roseindia.net/xml/dom/ Thanks
Document Object Model(DOM)
to use DOM in order to render an HTML document. However, JavaScript scripts... Document Object Model(DOM)       The Document Object Model (DOM) is a an standard object model
DOM to SAX and SAX to DOM - XML
DOM SAX Parser Java  What is the Difference between SAX and DOM parsers
DOM to SAX and SAX to DOM - XML
Java DOM to SAX and SAX to DOM  Simple API for XML and Document Object Model
What is JavaScript?
, and string libraries W3C DOM support in the JavaScript. For other JavaScript...What is JavaScript?  Hi, Sometime the students trying to know make... is Java script and other java related queries. How to define what is JavaScript
DOM - XML
DOM  Hi... I created an xml file through java by using DOM Now..I need to get the prompt for download when i clicked the button... I used downloadaction...for this But it didn't worked.. Its jus viewing the xml file
Dom in java
Dom in java  Exception in thread "main" org.w3c.dom.DOMException: INVALIDCHARACTERERR: An invalid or illegal XML character is specified... Create XML using DOM import java.io.*; import org.w3c.dom.*; import
JavaScript - JavaScript Tutorial
JavaScript's HTML DOM window object method clearTimeOut() method is used to stop...JavaScript - JavaScript Tutorial JavaScript Tutorials is one of the best Quick reference to the JavaScript. In this JavaScript reference you will find
DOM - XML
DOM  Hello.... I'm creating an xml file from java using DOM... from the database values... and saving it in a file But the created xml file is generating all its files in a single line.. But i need to get the next tag
JavaScript clearTimeOut method
JavaScript clearTimeOut method       JavaScript's HTML DOM window object method.... In this section of JavaScript methods tutorials we will be able to clear the set time out
Javascript Examples
of the DOM (Document Object Model) scripting.  JavaScript... JavaScript Examples     Clear cookie example Cookies can... using JavaScriptJavaScript getElementById innerHTML In JavaScript
dom to xml string
dom to xml string  Hi, I am writing a program in java that reads... have save the dom document into xml file. How to convert dom to xml string... for converting DOM object into string data. Please check the thread dom to xml
What is JavaScript? - Definition
DOM support in the JavaScript Disadvantages of JavaScript Developer depends... What is JavaScript? - Definition  ... the basics of JavaScript and create your first JavaScript program. What
Java dom from string
Java dom from string  Hi, How to create dom tree from string data? I am trying to search the example for java dom from string. Thanks   Hi, Following code might be useful: import java.io.StringReader; import
Java-XML-DOM - XML
Java-XML-DOM  Hi! I need some help. I have to make java program that loads an xml file and from it builds DOM(later i will have to work with it - like using xpath in java find some value and replace it...). Since i'm new to java
DOM API - Java Beginners
DOM API  How can i go through each and every node of an xml file Each and everyChild? my xml file is given below: 810 32 141 22
DOM paring problem
DOM paring problem  Hi My code always show arrayindexoutofbound here is my code i am using arraylist to display and DOM parser to retrieve XML value. I am searching the value by attributes equals 2. this error i am getting
DOM paring problem
DOM paring problem  Hi My code always show arrayindexoutofbound here is my code i am using arraylist to display and DOM parser to retrieve XML value. I am searching the value by attributes equals 2. this error i am getting
DOM API - Java Beginners
DOM API  How can i go through each and every node of an xml file Each and everyChild? my xml file is given below...); } } } ---------------------------------------------- Read for more information. http://www.roseindia.net/xml/dom
JavaScript
JavaScript  clone JavaScript
JavaScript XML Parser
to access and manipulate XML document using DOM parser in javascript. XML parser reads and loads the xml into computer memory and converts it into DOM object... JavaScript XML Parser    
JavaScript Reporter(tm) JavaScript Tool
includes a DOM dictionary that allows it to check all aspects of JavaScript programs... JavaScript Reporter(tm) JavaScript Tool       JavaScript Reporter quickly locates
javascript
javascript  javascript code to dynamically add table on button click.../javascript/javascriptexamples/javascript-add-row-dynamically.shtml http://www.roseindia.net/javascript/javascript-add-row-to-table.shtml http://www.roseindia.net
JavaScript XML to HTML
JavaScript XML to HTML    ... to access and manipulate the DOM parser in the previous section. Here we have used the DOM reference to display the data of XML document into html table. For this, we
Javascript
Javascript  How validations are done using javascript ,with example? and interview questions on javASCRIPT
JavaScript
should use JavaScript? Thanks   Hi, JavaScript is scripting language that runs on browser. You have to embed JavaScript in HTML page. Please see JavaScript tutorial. Thanks
JavaScript
JavaScript  how to get full path of a file type in javascript
javascript
javascript  Hi deepak, how to write form validation on javascript
javascript
javascript  write a program to display implement about browsers using javascript
javaScript
javaScript  How to open a browser window that cannot be resized? (HTML + Javascript
javascript
javascript  i have just learned javascript... can you tell me what kind of applications can be made by javascript?? thank you
Inserting content(DOM Insertion)
Inserting content(DOM Insertion)       Inserting content(DOM Insertion) Inserting Dom contents to html ,can be categories in the following 4 categories
javascript
javascript  how to set the request or session attribute in javascript head part of jsp page
DOM Parser Tutorial
DOM Parser Tutorial Introduction Dom stands for Document Object Model.... It is available in package org.w3c.dom. Dom is a cross-language API. It provides many... tree elements. With the help of Dom api, user  can add, delete
JavaScript getElementById div
JavaScript getElementById div...; In JavaScript we can get access to any node by using the method document.getElementById(). This method is very important for the JavaScript and is the entry
JAVASCRIPT
JAVASCRIPT  I have one textbox and I want to validate that it must start with number(1-0). can anyone tell me a javascript for that ? thanks in advance
Javascript
Javascript   Javascript to check Numeric entry in checkbox.....   Hi Please find the following code for numeric entry validation in javascript function validateBox(){ var data=document.myForm.someText.value
Create an Empty DOM Document
Create an Empty DOM Document       This Example shows how to create an empty DOM Document . JAXP... documents. Here the Document BuilderFactory is used to create new DOM parsers
javascript
javascript  hi, I was actually working on to calculate the number of days between two dates of yyyy-mm-dd format using javascript, and when i click on button then number of days should be display in textbox
javaScript
javaScript  . Print a table like below in JAVASCRIPT 5 x 1 = 5 5 x 2 = 10 ΓΆβ?¬Β¦ΓΆβ?¬Β¦ΓΆβ?¬Β¦. 5 x 20 = 100
javascript
javascript  passing javascript values to jsp   Hi Friend, Try the following code: form.jsp: <html> <script> function getMsg...;/script> <input type="button" onclick="getMsg();" value="Get Javascript value
Javascript
this format xxx-xxx-xxxx, i want the code in javascript. as a function.   Javascript Phone Number Validation <html> <script> function..." method="post" onsubmit="javascript:return validate();"> Phone Number:<
Javascript
Javascript  Dear Sir, Thank You a lot for your continuos support.Again i am in need of your help. What is the javascript code to disable a link,once... javascript or css Please help me.Urgent Regards Debasis   Hello Friend
XML DOM Tutorial
XML DOM Tutorial       W3C provides a standard called DOM (Document Object Model) for HTML & XML documents. DOM is also used as an interface for accessing and manipulating HTML & XML
XML DOM error - Java Beginners
XML DOM error  import org.w3c.dom.*; import javax.xml.parsers.*; import java.io.*; public class DOMCountElement{ public static void main(String[] args) { try { BufferedReader bf = new BufferedReader(new
Javascript
Javascript  <html> <head> <script type="text/javascript"> function validateForm() { var sname=document.getElementById('spocname'); var scontact=document.getElementById('spoccontact'); if(sname.value.length

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.