www.webdeveloper.com
Results 1 to 3 of 3

Thread: crosswords

  1. #1
    Join Date
    Jun 2011
    Posts
    140

    crosswords

    I am looking for (but not having much luck on google) a service that allows you to embed a crossword in to a webpage, but I dont just want the user to complete the crossword, i want the user to submit the completed crossword to me.

    Failing that, I'd like to embed a crossword that has selected letters highlighted to make a word (you know the one, right) and then I can just have a form below for the user to send me the word once completed.

    Any ideas?

    Thanks, Adrian

  2. #2
    Join Date
    Nov 2010
    Posts
    1,031
    you will have to make a <form> so that you can submit it to your server. You are best off using dom methods and loops otherwise it's going to be a lot of repetitive typing. This might help as a starting point:

    Code:
    <html>
    <head>
    </head>
    
    <body>
    <form name="myform"></form>
    <script>
    var theform=document.myform
    for (var e=1; e<65; e++) { //change 65 to allow for more or less boxes in total
    sq=document.createElement("input")
    brk=document.createElement("br")
    sq.type="text";
    sq.name="box"+e;
    sq.size="1"
    sq.maxLength=1;
    theform.appendChild(sq)
    if(e&#37;8==0){theform.appendChild(brk)}//change to allow for more or less boxes in row 
    }
    
    blksq=[1,7,10,14,27,53] //numbers here put black squares on the grid
    for (var i=0; i<blksq.length; i++) {
    num=blksq[i]-1
    el=document.myform.getElementsByTagName("input")[num]
    el.readOnly="true"
    el.value=""
    el.style.backgroundColor="#000000"
    }
    
    numbers=[2,8,9,11,15,18] //numbers here put numbers in the squares on the grid
    for (var i=0; i<numbers.length; i++) {
    num2=numbers[i]-1
    el2=document.myform.getElementsByTagName("input")[num2]
    el2.value=i+1
    }
    </script>
    </body>
    </html>
    Last edited by xelawho; 01-10-2012 at 06:17 PM.

  3. #3
    Join Date
    Jun 2011
    Posts
    140
    Hi xelawho, you really do like a challenge don't you haha

    Well thanks for the code, thats a brilliant start and I can work with that to create the crosswords. I am not too sure what angle I want to take on this, it's for a site that I may not end up going through with because i'm still looking at the legalities and gambling laws etc etc

    Basically, to run a legal competition, it has to have an element of skill, and the most common seems to be the "spot the ball" method but I thought i'd just try and be different and do a sudoku or a crossword puzzle.

    So I would have to get the user to register/login and then they would have access to pay for their entry in to the crossword bit, with fully completed and correct entries then going in to the raffle. (This is the bit I am not sure of the legalities). I have never even set up a register/log in "thing" before without phpbb which is how I have done it on the other site you helped me with.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles