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.

View Poll Results: I need help with Forms

Voters
0. You may not vote on this poll
  • ??

    0 0%
  • ??

    0 0%
Results 1 to 4 of 4

Thread: Forms

  1. #1
    New to the CF scene
    Join Date
    Sep 2002
    Location
    NZ
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Smile Forms

    Hi there,

    Hoping someone can help me?

    I'm after some code whereby when a user clicks on an answer to a question either a 'tick' or a 'cross' appears and stays to show whether the answer the user has selected is correct or not.

    Can anyone help me?

    Cheers, EM

  • #2
    Senior Coder Nightfire's Avatar
    Join Date
    Jun 2002
    Posts
    4,266
    Thanks
    6
    Thanked 48 Times in 48 Posts
    The point of the poll is...?

    You have server side support on your host?

  • #3
    New to the CF scene
    Join Date
    Sep 2002
    Location
    NZ
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Unhappy

    Sorry maybe I didn't explain myself properly.

    When a word is 'clicked' on I want a picture to appear and to remain on screen.

    I don't know a lot about html, and I am currently using Frontpage 2000, which I'm sure you will think ?????, but thought it was worth asking, its the only way I will find out.

    If this is the wrong place for this, please accept my apology and ignore this.

    E

  • #4
    Senior Coder
    Join Date
    Aug 2002
    Location
    UK
    Posts
    2,789
    Thanks
    2
    Thanked 14 Times in 14 Posts
    Something on the lines of this:



    <HTML><HEAD><TITLE>Take Your Pick</TITLE>

    <SCRIPT language=JavaScript>
    <!--
    which=null
    no_match=0
    pick=new Array() //
    pick[pick.length] = new Array("red","herring","flag","alert",3)
    pick[pick.length] = new Array("silver","spoon","lining","mine",1)
    pick[pick.length] = new Array("tea","spoon","bag","cup",2)
    pick[pick.length] = new Array("sun","flower","tan","spot",1)
    pick[pick.length] = new Array("treasure","island","chest","trove",2)
    pick[pick.length] = new Array("sweet","corn","tooth","pea",3)
    pick[pick.length] = new Array("tooth","brush","paste","fairy",3)



    function Auto_Enter_Word(n){
    aaa=pick[n][0]
    Enter_Word()
    }


    function Enter_Word(){
    no_match=0
    note.innerHTML=""

    clearRads()

    for(i=0;i<pick.length;i++){
    if(pick[i][0]==aaa){
    no_match=1
    which=i
    document.opt.choice1.value=pick[i][1]
    document.opt.choice2.value=pick[i][2]
    document.opt.choice3.value=pick[i][3]
    }
    }

    if(no_match==0){
    note.innerHTML="\"<b>"+aaa+"</b>\" is not in the list"
    document.opt.reset()
    }
    else{
    note.innerText="&nbsp;"
    }
    }

    function clearRads(){ // check radios not selected
    for(i=0;i<document.opt.answer.length;i++)
    if (document.opt.answer[i].checked==true){ // if selected
    document.opt.answer[i].checked=false // deselect
    }
    }

    function Match_Word(){
    if(no_match==0){return}
    if(which==null){return}

    for(j=0;j<document.opt.answer.length;j++){
    if(document.opt.answer[j].checked==true){

    if(document.opt.answer[j].value=="choice"+pick[which][4]){
    note.innerHTML="\"<b><font color='green'>"+pick[which][j+1]+"</b></font>\" is correct"
    //alert(document.opt.answer[j].value+" = " +pick[which][j+1])
    }
    else{
    note.innerHTML="\"<b><font color='red'>"+pick[which][j+1]+"</b></font>\" is not correct"
    }
    }

    }
    }

    //-->
    </SCRIPT>
    </HEAD><BODY>
    <center>
    <FORM name=opt>
    <table border="1">
    <tr><td>&nbsp;</td><td>Reference 1</td><td>Reference 2</td><td>Reference 1</td></tr>
    <tr><td>
    <select onChange="Auto_Enter_Word(options[selectedIndex].value)">
    <option></option>
    <option value="0">Red
    <option value="1">Silver
    <option value="2">Tea
    <option value="3">Sun
    <option value="4">Treasure
    <option value="5">Sweet
    <option value="6">Tooth
    </select></td>
    <td><INPUT name="choice1" size="12"></td><td><INPUT name="choice2" size="12"></td><td><INPUT name="choice3" size="12"></td></tr>

    <tr align="center"><td><INPUT type="reset" value="Reset"></td><td><input type="radio" name="answer" value="choice1" onclick="Match_Word()"></td>
    <td><input type="radio" name="answer" value="choice2" onclick="Match_Word()"></td>
    <td><input type="radio" name="answer" value="choice3" onclick="Match_Word()"></td></tr>
    <tr><td colspan="4"><div id="note">&nbsp;</div></tr>
    </table>
    </center>
    </FORM>

    </BODY></HTML>



  •  

    Posting Permissions

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