Page 1 of 2 12 LastLast
Results 1 to 10 of 13

Thread: somethins wrong with my form, but i dont know what.

  1. #1
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default somethins wrong with my form, but i dont know what.

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

  2. #2
    Join Date
    Jan 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This worked for me!

    <!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">&nbsp;</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>

  3. #3
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by darco9x2
    <SCRIPT LANGUAGE="javascript">
    The language attribute has been deprecated for over six years. Use the (required) type attribute instead:

    HTML Code:
    <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).

    HTML Code:
    <h1>The Fish<hr></h1>
    Code:
    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:

    HTML Code:
    <form action="" onsubmit="return false;">
      <select name="links" size="1">
      <option value="" selected>--&gt; Choose a link &lt;--</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.

    Code:
    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 &#91;code&#93; or &#91;html&#93; pseudo-tags when posting code and properly indent any scripts. They're a lot more readable that way.

    Mike
    Last edited by mwinter; 01-10-2005 at 12:17 AM. Reason: Forgot to point out a change

  4. #4
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    sorry, i just copied the code from the page. thanks

    maybe its just freewebs wont let me use forms
    Last edited by darco9x2; 01-10-2005 at 09:48 PM.

  5. #5
    Join Date
    Jan 2005
    Posts
    10
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default This is the basic form you're on, the drop down box goes nowhere

    <!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 &lt;--</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>

  6. #6
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    does the link part work for anybody else?

    i think freewebs does not let forms work unless you pay
    Last edited by darco9x2; 01-11-2005 at 10:00 PM.

  7. #7
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    here is the link to the page:
    doesnt work still...
    click here

  8. #8
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by darco9x2
    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

  9. #9
    Join Date
    Dec 2004
    Posts
    157
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    just the
    <script type="text/javascript"> part?

  10. #10
    Join Date
    Dec 2004
    Location
    UK
    Posts
    2,358
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default

    Quote Originally Posted by darco9x2
    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

Bookmarks

Posting Permissions

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