View Full Version : somethins wrong with my form, but i dont know what.
darco9x2
01-09-2005, 10:59 PM
<html>
<head>
<link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>
fish links
</title>
<script>
var x,y
var step=20
var flag=0
var message="The Fish "
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50
}
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script>
<SCRIPT LANGUAGE="javascript">
function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[number].value;
}
</SCRIPT>
</head>
<body onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow-y:scroll">
<center><h4>The Fish<hr width=30%></h4></center>
<br>
<BR>
<BR>
<div>Please select the type of fish you would like to learn about:
<br>
<FORM>
<SELECT NAME="DDlinks">
<OPTION SELECTED>--> Choose a Link <--
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Rainbow.html"> Rainbow Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Brook.html"> Brook Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/brown.html"> German Brown Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/golden.html">Golden Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/steelhead.html">Steelhead
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Macinaw.html">Macinaw
<option value="http://www.freewebs.com/fly-fishisherman/kokanee.html">Koakanee
<option value="http://www.freewebs.com/fly-fishisherman/cutthroat.html">Cutthroat Trout
</SELECT>
<INPUT TYPE="Submit" VALUE="Click to Go!" onClick="LinkUp()">
</FORM>
</div>
<script>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</script>
</body>
</html>
so what did i do wrong?
its the form part, jsut ignore the rest.
theprincessbride
01-09-2005, 11:47 PM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head><link rel="stylesheet" type="text/css" href="stylesheet.css">
<title>fish links</title>
</head>
<body bgcolor="#ffffff"> </body>
</html>
<script>
var x,y
var step=20
var flag=0
var message="The Fish "
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50
}
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script>
<SCRIPT LANGUAGE="javascript">
function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[number].value;
}
</SCRIPT>
</head>
<body onLoad="makesnake()" style="width:100%;overflow-x:hidden;overflow-y:scroll">
<center><h4>The Fish<hr width=30%></h4></center>
<br>
<BR>
<BR>
<div>Please select the type of fish you would like to learn about:
<br>
<FORM>
<SELECT NAME="DDlinks">
<OPTION SELECTED>--> Choose a Link <--
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Rainbow.html"> Rainbow Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Brook.html"> Brook Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/brown.html"> German Brown Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/golden.html">Golden Trout
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/steelhead.html">Steelhead
<OPTION VALUE="http://www.freewebs.com/fly-fishisherman/Macinaw.html">Macinaw
<option value="http://www.freewebs.com/fly-fishisherman/kokanee.html">Koakanee
<option value="http://www.freewebs.com/fly-fishisherman/cutthroat.html">Cutthroat Trout
</SELECT>
<INPUT TYPE="Submit" VALUE="Click to Go!" onClick="LinkUp()">
</FORM>
</div>
<script>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</script>
</body>
</html>
mwinter
01-10-2005, 12:14 AM
<SCRIPT LANGUAGE="javascript">The language attribute has been deprecated for over six years. Use the (required) type attribute instead:
<script type="text/javascript">
function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[number].value;
}Here you attempt to reference a the form with the identifier DropDown, however no such element exists. The quick fix would be to give the form the right name, however there's a better way.
<center><h4>The Fish<hr width=30%></h4></center>Don't skip heading levels just because they aren't the right size. You have a stylesheet so use it. The following mark-up and CSS should be equivalent (including the line breaks).
<h1>The Fish<hr></h1>
body {
font-size: 100%;
}
h1 {
font-size: 105%;
margin-bottom: 2.5em;
text-align: center;
}
h1 hr {
width: 30%;
}Now for the drop-down navigation list:
<form action="" onsubmit="return false;">
<select name="links" size="1">
<option value="" selected>--> Choose a link <--</option>
<!-- Other options -->
</select>
<input type="submit" value="Go!" onclick="goTo(this);">
</form>Notice that the initial option has an explicit empty string as its value.
function goTo(btn) {var links = btn.form.elements['links'], link;
if((link = links.options[links.selectedIndex].value)) {
location = link;
}
}Preferably, the form would submit to a redirection script on the server that would provide a fallback if a user had Javascript disabled.
its the form part, jsut ignore the rest.I'm glad. It's a little too late to delve into the rest of it.
By the way, could you please use the [code] or [html] pseudo-tags when posting code and properly indent any scripts. They're a lot more readable that way.
Mike
darco9x2
01-10-2005, 09:41 PM
sorry, i just copied the code from the page. thanks
maybe its just freewebs wont let me use forms
theprincessbride
01-11-2005, 04:12 AM
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>fish links</title>
<link href="stylesheet.css" type="text/css" rel="stylesheet">
</head>
<body style="overflow-y: scroll; overflow-x: hidden; width: 100%;" bgcolor="#ffffff">
<script>
var x,y
var step=20
var flag=0
var message=""
message=message.split("")
var xpos=new Array()
for (i=0;i<=message.length-1;i++) {
xpos[i]=-50
}
var ypos=new Array()
for (i=0;i<=message.length-1;i++) {
ypos[i]=-50
}
function handlerMM(e){
x = (document.layers) ? e.pageX : document.body.scrollLeft+event.clientX
y = (document.layers) ? e.pageY : document.body.scrollTop+event.clientY
flag=1
}
function makesnake() {
if (flag==1 && document.all) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("span"+(i)+".style")
thisspan.posLeft=xpos[i]
thisspan.posTop=ypos[i]
}
}
else if (flag==1 && document.layers) {
for (i=message.length-1; i>=1; i--) {
xpos[i]=xpos[i-1]+step
ypos[i]=ypos[i-1]
}
xpos[0]=x+step
ypos[0]=y
for (i=0; i<message.length-1; i++) {
var thisspan = eval("document.span"+i)
thisspan.left=xpos[i]
thisspan.top=ypos[i]
}
}
var timer=setTimeout("makesnake()",30)
}
</script>
<script language="javascript">
function LinkUp()
{
var number = document.DropDown.DDlinks.selectedIndex;
location.href = document.DropDown.DDlinks.options[number].value;
}
</script>
<center>
<h4>The Fish
<hr width="30%"></h4></center>
<br>
<br>
<br>
<div>Please select the type of fish you would like to learn about:
<br>
<form><select name="DDlinks">
<option value="" selected="selected">--> Choose a Link <--</option>
<option value="http://www.freewebs.com/fly-fishisherman/Rainbow.html">Rainbow Trout</option>
<option value="http://www.freewebs.com/fly-fishisherman/Brook.html">Brook Trout</option>
<option value="http://www.freewebs.com/fly-fishisherman/brown.html">German Brown Trout</option>
<option value="http://www.freewebs.com/fly-fishisherman/golden.html">Golden Trout</option>
<option value="http://www.freewebs.com/fly-fishisherman/steelhead.html">Steelhead</option>
<option value="http://www.freewebs.com/fly-fishisherman/Macinaw.html">Macinaw</option>
<option value="http://www.freewebs.com/fly-fishisherman/kokanee.html">Koakanee</option>
<option value="http://www.freewebs.com/fly-fishisherman/cutthroat.html">Cutthroat Trout</option></select>
<input onclick="LinkUp()" type="submit" value="Click to Go!"> </form></div>
<script>
<!-- Beginning of JavaScript -
for (i=0;i<=message.length-1;i++) {
document.write("<span id='span"+i+"' class='spanstyle'>")
document.write(message[i])
document.write("</span>")
}
if (document.layers){
document.captureEvents(Event.MOUSEMOVE);
}
document.onmousemove = handlerMM;
// - End of JavaScript - -->
</script>
</body>
</html>
darco9x2
01-11-2005, 09:56 PM
does the link part work for anybody else?
i think freewebs does not let forms work unless you pay
darco9x2
01-11-2005, 10:10 PM
here is the link to the page:
doesnt work still...
click here (http://www.freewebs.com/fly-fishisherman/fish.html)
mwinter
01-11-2005, 10:28 PM
doesnt work still...Because you haven't corrected the error in your script. Replace it with the code I suggested in my previous post.
Mike
darco9x2
01-11-2005, 10:33 PM
just the
<script type="text/javascript"> part?
mwinter
01-11-2005, 11:21 PM
just the
<script type="text/javascript"> part?That won't affect execution (though you should still make the change), it just makes your mark-up valid.
I meant all of it. Search for "Now for the drop-down navigation list:" in my first post. Use the mark-up and the script code shown below that point.
Mike
darco9x2
01-12-2005, 09:01 PM
i did the changes and it doesnt work, check the current code.
mwinter
01-13-2005, 10:37 AM
i did the changesNo, you didn't.
and it doesnt workOf course not...
check the current code....now there isn't a select element anywhere in your source and you still have the same non-functioning script.
Here's an example (http://www.mlwinter.pwp.blueyonder.co.uk/dd/darco/drop-down.html).
Mike
darco9x2
01-13-2005, 09:37 PM
well, i changed my mine, this is too complicated so i chose a different type of table thing
Powered by vBulletin® Version 4.2.2 Copyright © 2021 vBulletin Solutions, Inc. All rights reserved.