...

View Full Version : Help for a beginner



MannyOmi
05-10-2006, 12:27 AM
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

WMJB
05-10-2006, 02:06 AM
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.

MannyOmi
05-10-2006, 02:54 AM
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?

mike24
05-15-2006, 02:23 AM
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

boxxer03
05-15-2006, 06:15 AM
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.


<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>

danelkayam
05-15-2006, 03:03 PM
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.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum