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.
Results 1 to 2 of 2
  1. #1
    New Coder
    Join Date
    Nov 2012
    Location
    Canada
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    conditional statement show image

    I'm expanding on my Canadian Postal Code validation. If the user enters the right format I want a .jpg of a checkmark to appear in a div. If the user enters the wrong format I want a .jpg of a big red x to appear the div. Currently, I have text string warnings if the user enters the wrong format. Now I want image warnings.

    I have tried:

    Code:
    if (check1.test(getfirst3))
    {document.getElementById("warning").src="bigredx.jpg";}

  2. #2
    New Coder
    Join Date
    Nov 2012
    Location
    Canada
    Posts
    35
    Thanks
    5
    Thanked 0 Times in 0 Posts

    found the solution

    Found the solution to get the image as well as keep the text string warning.

    Code:
    if (check1.test(getfirst3))
    {document.getElementById("warning").innerHTML = warning1 
    
    +"<img src='bigredx.jpg' width='50' height='50'/>";}


 

Tags for this Thread

Posting Permissions

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