Web Analytics Made Easy -
StatCounter please help - CodingForum

Announcement

Collapse
No announcement yet.

please help

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

  • please help

    Here is some code that I am working with

    --html--
    <INPUT type="text" name=a1c />

    --js--
    document.myquiz.a1c.value = "CORRECT!";


    How can I replace the string "Correct!" with an image???
    Something like this:
    document.myquiz.a1c.value = "<img src ...... />;


    Thank you

  • #2
    Edit: facepalm
    Last edited by devnull69; Sep 12, 2011, 02:08 PM.

    Comment


    • #3
      Code:
      <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd">
      <html lang="en">
      <head>
      <meta http-equiv="content-type" content="text/html; charset=utf-8">
      <meta name="generator" content="daveyerwin">
      <title>Untitled</title>
      <script type="text/javascript">
      function addBkGrnd(){
          document.myquiz.a1c.style.backgroundImage="url('test.jpg')";
      }
      </script>
      <style type="text/css">
      
      </style>
      </head>
      <body>
      <form name="myquiz" action=""><p>
      <input type="text" name="a1c">
      <input type="button" onclick="addBkGrnd();">
      </P></form>
      </body>
      </html>
      Last edited by DaveyErwin; Sep 12, 2011, 02:29 PM.

      Comment


      • #4
        Thank you. Now what if I wanted to add some text after the image. How would I do that? Thanks.

        Comment


        • #5
          Originally posted by lm111 View Post
          Thank you. Now what if I wanted to add some text after the image. How would I do that? Thanks.
          The same way youadded it before ...
          document.myquiz.a1c.value = "CORRECT!";

          depending on exactly your image
          it will go on top of image
          with a added spaces and the
          right image and a no-repeat css
          it can be before or after image

          Comment


          • #6
            You could also simply do
            Code:
            <form name="myquiz" action="">
            <div id="a1c" style="visibility: hidden;">
                <img src="OhGoody.jpg" style="float: left;">CONGRATULATIONS!
            </div>
            <input type="button" 
                   onclick="document.getElementById('a1c').style.visibility='visible';">
            </form>
            Be yourself. No one else is as qualified.

            Comment


            • #7
              Thank you. One other question. How can I make the input box multiline, the text does not wrap? Any idea? thank you

              <INPUT type="text" style="BORDER-LEFT-COLOR: #ffffff; BORDER-BOTTOM-COLOR: #ffffff; COLOR: #808080; BORDER-TOP-STYLE: solid; BORDER-TOP-COLOR: #ffffff; BORDER-RIGHT-STYLE: solid; BORDER-LEFT-STYLE: solid; BORDER-RIGHT-COLOR: #ffffff; BORDER-BOTTOM-STYLE: solid; color:red; background-repeat:no-repeat; font-size:14px; width:100%;" name=a1c />

              Comment


              • #8
                Use a textarea element rather than an input element and the text wrapping will be what you expect.
                The object of opening the mind, as of opening the mouth, is to shut it again on something solid. –G.K. Chesterton
                See Mediocrity in its Infancy
                It's usually a good idea to start out with this at the VERY TOP of your CSS: * {border:0;margin:0;padding:0;}
                Seek and you shall find... basically:
                validate your markup | view your page cross-browser/cross-platform | free web tutorials | free hosting

                Comment


                • #9
                  Thank you !!!

                  Comment

                  Working...
                  X
                  😀
                  🥰
                  🤢
                  😎
                  😡
                  👍
                  👎