CodeGuru Home VC++ / MFC / C++ .NET / C# Visual Basic VB Forums Developer.com
Results 1 to 4 of 4
  1. #1
    Join Date
    Dec 2009
    Posts
    2

    Exclamation a little confused

    hey everyone iam fairly new to javascript and struggling a little and i have a few questions
    below is my code and iam trying to make a site that when you click on the check box the desired paragraph will appear maybe everyone can assist me with this?

  2. #2
    Join Date
    Dec 2009
    Posts
    2

    Re: a little confused

    here is meh code


    <?xml version="1.0" encoding="UTF-8"?>
    <!DOCTYPE html PUBLIC '-//W3C//DTD XHTML 1.0 Transitional//EN'
    'http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd'>
    <html xmlns='http://www.w3.org/1999/xhtml' xml:lang='en' lang='en'>

    <head>
    <title> PROJECT 6-- OBJECTIVE</title>
    <meta http-equiv='Content-Type' content='text/html; charset= utf-8' />


    <style type="text/css">

    h2 {text-align:center}
    h3 {text-align:center}

    body {background-color:#cccccc;}

    </style>

    <!--
    COP 1830 -
    Filename:
    Written by:
    Last revised:
    -->
    </head>
    <body>


    <h2>JavaScript Objects Project</h2>

    <form>


    <div style="text-align:center ;border:1px solid red">

    <text-align="left"><strong>Show:</strong>

    <input type="checkbox" name="objective" value=objective" /> Objective


    <input type="checkbox" name="details" value="details" /> details


    <input type="checkbox" name="submissions" value="submissions" /> submissions
    </form>


    </div>

    <script type="text/javascript">




    if (obj = true

    }
    document.write("testing");
    }
    </script>

  3. #3
    Join Date
    Jul 2005
    Location
    Currently in Mexico City
    Posts
    568

    Re: a little confused

    1. When posting code please USE CODE TAGS
    2. This is Java forum. JavaScript has nothing to do with Java (except certain naming/syntax similarities). JavaScript forums are here: http://www.codeguru.com/forum/forumdisplay.php?f=8

    3. Here's the answer:
    Code:
    <script type="text/javascript">
    function showText(checkBox){
    	if(checkBox.checked){
    		document.getElementById(checkBox.value).style.display = "block";
    	}else{
    		document.getElementById(checkBox.value).style.display = "none";
    	}
    }
    </script>
    
    
    <input type="checkbox" name="objective" value="objective" onclick="showText(this);" /> Objective <br />
    <input type="checkbox" name="details" value="details" onclick="showText(this);" /> Details <br />
    <input type="checkbox" name="submissions" value="submissions" onclick="showText(this);" /> Submissions <br />
    
    <p id="objective" style="display:none;">Objective description text...</p>
    <p id="details" style="display:none;">Details description text...</p>
    <p id="submissions" style="display:none;">Submissions descriptions...</p>
    Wanna install linux on a vacuum cleaner. Could anyone tell me which distro sucks better?

    I had a nightmare last night. I was dreaming that I’m 64-bit and my blanket is 32-bit and I couldn’t cover myself with it, so I’ve spent the whole night freezing. And in the morning I find that my blanket just had fallen off the bed. =S (from: bash.org.ru)

    //always looking for job opportunities in AU/NZ/US/CA/Europe :P
    willCodeForFood(Arrays.asList("Java","PHP","C++","bash","Assembler","XML","XHTML","CSS","JS","PL/SQL"));

    USE [code] TAGS! Read this FAQ if you are new here. If this post was helpful, please rate it!

  4. #4
    Join Date
    May 2009
    Posts
    2,413

    Re: a little confused

    Quote Originally Posted by painfull View Post
    iam fairly new to javascript and struggling a little and i have a few questions
    This is the wrong place to ask those questions because Javascript, despite its name, has nothing to do with Java.

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
  •  





Click Here to Expand Forum to Full Width

Featured