bjorkfan19
11-27-2002, 05:10 PM
I'm working on calculating the distance between two points. I'm still very much in the learning phase of Javascript, but I have almost everything I need. I have the database for the points, and the basic structure of the script. I just can't get the points to show up for the user to choose the two and thus calculate the distance. So basically, I have no idea if the script is functional at all.
Here's the gist of it:
<SCRIPT TYPE="text/javascript" LANGUAGE="Javascript"><!--
var cities = getPoints();
document.writeIn("<SELECT>");
for( var c = 0; c < points.length; c++ ) {
document.writeIn("<OPTION>");
document.writeIn(c+1);
document.write("</SELECT>"); }
function makeLocation(){
with(document.pointsmenu){
var frompoint, topoint;
frompoint=point1.selectedIndex;
topoint=point2.selectedIndex;
}
}
function distance(){
with(document.pointsmenu)
document.pointsmenu.reply.value=document.pointsmenu.point1.value+"<BR>"+point2.value+"<BR>"+"Distance between the points"+distance;
}
//--></SCRIPT>
That looks to be a correct way of implementing a drop-down box. But nothing shows up on the page. Can anyone tell me what's wrong? I've looked high and low and am at a loss.
Here's the gist of it:
<SCRIPT TYPE="text/javascript" LANGUAGE="Javascript"><!--
var cities = getPoints();
document.writeIn("<SELECT>");
for( var c = 0; c < points.length; c++ ) {
document.writeIn("<OPTION>");
document.writeIn(c+1);
document.write("</SELECT>"); }
function makeLocation(){
with(document.pointsmenu){
var frompoint, topoint;
frompoint=point1.selectedIndex;
topoint=point2.selectedIndex;
}
}
function distance(){
with(document.pointsmenu)
document.pointsmenu.reply.value=document.pointsmenu.point1.value+"<BR>"+point2.value+"<BR>"+"Distance between the points"+distance;
}
//--></SCRIPT>
That looks to be a correct way of implementing a drop-down box. But nothing shows up on the page. Can anyone tell me what's wrong? I've looked high and low and am at a loss.