Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 6 of 6
  1. #1
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Help for a beginner

    Hi,

    I'm a new member on here, and I'd like to request some help.

    I'm doing an assignment where I need to present the results of a sensor network to Honduran villagers, to indicate water levels in case they need to evacuate. for this, i plan to use animation. the actual information from the sensors is not my concern, and i can assume that the informaton will arrive from the network in a way that can be displayed graphically.

    therefore, i want to produce an water animation that will decrease and increase according to numerical values (which for this purpose will be generated randomly when a button is pressed). the animation will feature a man, woman, and child, and show how high the water is in relation to them. obviously, when the water gets too high, the villagers will then know they have to evacuate. can anyone make any suggestions as to how this can be achieved? i am limited to HTML and JavaScript to be able to achieve this

  • #2
    New Coder
    Join Date
    Mar 2005
    Posts
    61
    Thanks
    0
    Thanked 0 Times in 0 Posts
    You can have a DIV element with blue background to simulate the water level. You can set the height of the DIV element using javascript very easily and can repeat the process with every keystroke. This DIV element can be positioned next to the image of the man women and child.
    "It doesn't matter if I'm optomistic or not, nothing ever works out for me."

  • #3
    New to the CF scene
    Join Date
    May 2006
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    yeah thanks, sounds do-able. one thing that i'm not sure about though....

    in real life, the water levels would be dictated by the input from the sensors, so in order to replicate this when demonstrating the site, i need to be able to assign each level a particular numerical range, so that for instance when the value is x, the water level will be y.

    Upon the site loading, refreshing, or the user pressing a button, i'll need a random number generator to assign a value in order for a graphic to be displayed. i don't know how simple or complicated i'm making this sound, but i hope you'll understand what i'm getting at. do you have any suggestion?

  • #4
    New to the CF scene
    Join Date
    May 2006
    Location
    southsea
    Posts
    1
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy another beginner to javascript

    Hi
    I am doing a OU course and am stuck on the program below;
    <script language="JavaScript" type="text/javascript">

    function findStartCodon(someBases, startingPlace) {

    var startCodonAt = -1;
    var aCodon = '';
    var codonFound = false;

    while ((codonFound == false) && ((startingPlace + 3) <= someBases.length)) {

    aCodon = someBases.substring(startingPlace, startingPlace + 3);

    if (aCodon == 'ATG') {

    startCodonAt = startingPlace;
    codonFound = true;
    } else {

    startingPlace = startingPlace + 3;
    }
    }

    return (startCodonAt);
    }


    //
    function testFindStartCodon() {

    var startCodonBeginsAt = -1;
    var someGeneticInfo = this.document.testForm.sequenceString.value;
    startCodonBeginsAt = findStartCodon(someGeneticInfo);
    if (startCodonBeginsAt != -1) {

    window.alert ();
    } else {

    window.alert ();
    }
    }
    </script>
    </head>

    <body>

    <strong>A test of the function testFindStartCodon().<br></strong>
    <form action="" method="post" name="testForm">
    <p>
    The sequence <input name="sequenceString" type="text" size="60" maxlength="128">
    </p>
    <input name="resetButton" type="reset" value="Clear Form">
    &nbsp;
    <input name="submitButton" type="button" value="Find Start Codon!" onClick="testFindStartCodon();">
    </form>

    all i get is this error;
    Error: testfindStartCodon is not defined
    Source File: file:///C:/Documents%20and%20Settings/michael%20clarke/My%20Documents/Unzipped/Genes_Files/Genes_Files/my%20Task03.html

    please any help or pointers, to what i am doing wrong would be a god send
    thanks
    michael

  • #5
    Regular Coder
    Join Date
    Sep 2005
    Location
    Chicago, IL
    Posts
    160
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by mike24
    Hi
    I am doing a OU course and am stuck on the program below;
    <script language="JavaScript" type="text/javascript">

    function findStartCodon(someBases, startingPlace) {

    var startCodonAt = -1;
    var aCodon = '';
    var codonFound = false;

    while ((codonFound == false) && ((startingPlace + 3) <= someBases.length)) {

    aCodon = someBases.substring(startingPlace, startingPlace + 3);

    if (aCodon == 'ATG') {

    startCodonAt = startingPlace;
    codonFound = true;
    } else {

    startingPlace = startingPlace + 3;
    }
    }

    return (startCodonAt);
    }


    //
    function testFindStartCodon() {

    var startCodonBeginsAt = -1;
    var someGeneticInfo = this.document.testForm.sequenceString.value;
    startCodonBeginsAt = findStartCodon(someGeneticInfo);
    if (startCodonBeginsAt != -1) {

    window.alert ();
    } else {

    window.alert ();
    }
    }
    </script>
    </head>

    <body>

    <strong>A test of the function testFindStartCodon().<br></strong>
    <form action="" method="post" name="testForm">
    <p>
    The sequence <input name="sequenceString" type="text" size="60" maxlength="128">
    </p>
    <input name="resetButton" type="reset" value="Clear Form">
    &nbsp;
    <input name="submitButton" type="button" value="Find Start Codon!" onClick="testFindStartCodon();">
    </form>

    all i get is this error;
    Error: testfindStartCodon is not defined
    Source File: file:///C:/Documents%20and%20Settings/michael%20clarke/My%20Documents/Unzipped/Genes_Files/Genes_Files/my%20Task03.html

    please any help or pointers, to what i am doing wrong would be a god send
    thanks
    michael
    This post shouldn't be here because its a whole nother problem. But here's the same code with a few corrections and changes.

    Code:
    <html>
    <head>
    <script language="JavaScript" type="text/javascript">
    
    function findStartCodon(someBases, startingPlace) {
    
    var startCodonAt = -1;
    var aCodon = '';
    var codonFound = false;
    
    while ((codonFound == false) && ((startingPlace + 3) <= someBases.length)) {
    
    aCodon = someBases.substring(startingPlace, startingPlace + 3);
    
    if (aCodon == 'ATG') {
    
    startCodonAt = startingPlace;
    codonFound = true;
    } else {
    
    startingPlace = startingPlace + 3;
    }
    }
    
    return (startCodonAt);
    }
    
    function testFindStartCodon() {
    
    var startCodonBeginsAt=-1;
    var someGeneticInfo=document.getElementById('sequenceString').value;
    startCodonBeginsAt=findStartCodon(someGeneticInfo);
    alertMe=(startCodonBeginsAt!=-1)?alert("not -1"):alert("is -1");
    }
    </script>
    </head>
    
    <body>
    <strong>A test of the function testFindStartCodon().<br></strong>
    <form id="testForm">
    <p>
    The sequence <input id="sequenceString" type="text" size="60" maxlength="128">
    </p>
    <input name="resetButton" type="reset" value="Clear Form">
    &nbsp;
    <input name="submitButton" type="button" value="Find Start Codon!" onClick="testFindStartCodon();">
    </form>
    </body>
    </html>
    Last edited by boxxer03; 05-15-2006 at 05:20 AM.
    I'm only telling you how I would do it, not how its supposed to be done. ;)

  • #6
    New Coder
    Join Date
    May 2006
    Posts
    18
    Thanks
    0
    Thanked 0 Times in 0 Posts
    I would have to tell you that using php would make your life much simpler but since you're limited to javascript I can't.


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •