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 6 of 6
  1. #1
    New Coder
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts

    could anyone help me with a basic assignment?

    http://i50.tinypic.com/2njcxn5.png

    basically.. a button that changes the color of that box.. the font to bold.. and changes a frame from two search engine websites.

  • #2
    Senior Coder jmrker's Avatar
    Join Date
    Aug 2006
    Location
    FL
    Posts
    3,146
    Thanks
    38
    Thanked 505 Times in 499 Posts
    Would be nice to see your attempts at the solutions rather than an image of the problems.

  • #3
    New Coder
    Join Date
    Nov 2009
    Location
    www.nn11.darkbb.com
    Posts
    39
    Thanks
    2
    Thanked 0 Times in 0 Posts
    not allowed to post assignments...

  • #4
    New Coder
    Join Date
    Nov 2009
    Posts
    14
    Thanks
    1
    Thanked 0 Times in 0 Posts
    got close here:
    Code:
    <html>
    <head>
    </head>
    
    <body>
    
    <img id="imgSearch" src="" alt="Websites" />
    <input type="button" value="Toggle Search" id="btnSearch" onclick = "toggle()"/>
    <br><br>
    
    Traffic Light: <span id="trafficLight">Traffic light stuff</span>
    <input type="button" value="Prevent Accident" id="btnTraffic" onclick = "changeColor()" />
    
    <br><br>
    <p id = "Stuff">I want this bold when you hit the button!
    <input type="button" value="Set Bold" id="btnBold" onclick = "setBold()"/> </p>
    
    <script type = "text/javascript">
    var Sx = 0;
    function toggle(){
    if (Sx%2 == 0) {
    Sx ++;
    window.location = "websiteA.com";
    }
    else {
    Sx ++;
    window.location  = "websiteB.com";
    }
    }
    
    var Tx = 0;
    function changeColor() {
    if (Tx%3 == 0) {
    document.getElementById("trafficLight").style.color="red";
    }
    if (Tx%3 == 1) {
    document.getElementById("trafficLight").style.color="yellow";
    }
    if (Tx%3 == 2) {
    document.getElementById("trafficLight").style.color="green";
    }
    Tx ++;
    }
    
    function setBold() {
    document.getElementById("Stuff").style.fontWeight= "bold";
    }
    
    </script>
    
    </body>
    </html>

  • #5
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,574
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    So what's missing???
    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.

  • #6
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    27,574
    Thanks
    80
    Thanked 4,620 Times in 4,583 Posts
    Oh, I see.

    You need an <iframe> to hold the search site URL.

    And then you need to change the ".src" property of the iframe, *NOT* the window.location.
    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
    •