Hello and welcome to our community! Is this your first visit?
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 4 of 4
  1. #1
    New to the CF scene
    Join Date
    Mar 2013
    Thanked 0 Times in 0 Posts

    Cut & Paste JavaScript Quiz Machine script- editing text box size

    I'm hoping that you may be able to assist me with a question relating to the Cut & Paste JavaScript Quiz Machine script that is contained on the website.

    Following the instructions provided on the website, I was able to successfully get the Quiz machine running in a browser.

    However, I would like to modify the code a little, in particular the size(width and height) of the boxes, where the question number, question, answers a-d, your choice and results. However, for the life of me, whatever I try I can't edit the width.

    See the code below: I have tried changing the size and that doesn't work

    <td ALIGN="RIGHT"><b>a)</b></td>
    <td><div align="left"><left><p><input TYPE="TEXT" NAME="choiceA" SIZE="75"></td>
    <td ALIGN="RIGHT"><b>b)</b></td>
    <td><div align="left"><left><p><input TYPE="TEXT" NAME="choiceB" SIZE="75"></td>
    Last edited by skipleemalt; 03-05-2013 at 04:53 PM. Reason: changing title

  • #2
    Supreme Master coder! Philip M's Avatar
    Join Date
    Jun 2002
    London, England
    Thanked 2,531 Times in 2,509 Posts
    The align tag is deprecated and obsolete.

    You should use css to position your HTML elements. Tables for this purpose are also very much discouraged.

    All advice is supplied packaged by intellectual weight, and not by volume. Contents may settle slightly in transit.

    All the code given in this post has been tested and is intended to address the question asked.
    Unless stated otherwise it is not just a demonstration.

  • #3
    Master Coder felgall's Avatar
    Join Date
    Sep 2005
    Sydney, Australia
    Thanked 645 Times in 635 Posts
    Use CSS to define how you want it to look.
    Learn Modern JavaScript - http://javascriptexample.net/
    Helping others to solve their computer problem at http://www.felgall.com/

    Don't forget to start your JavaScript code with "use strict"; which makes it easier to find errors in your code.

  • #4
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Thanked 4,325 Times in 4,291 Posts
    To give you an example:
    <style type="text/css">
    td.choiceLabel {
        text-align: right;
        font-weight: bold;
    td.choice {
        text-align: left;
    td.choice input {
        width: 250px;
    // more styles 
    // ...
        <td class="choiceLabel">a)</td>
        <td class="choice"><input type="text" name="choiceA"></td>
        <td class="choiceLabel">b)</td>
        <td class="choice"><input type="text" name="choiceB"></td>
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.


    Posting Permissions

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