Register

If this is your first visit, please click the Sign Up now button to begin the process of creating your account so you can begin posting on our forums! The Sign Up process will only take up about a minute of two of your time.

Results 1 to 1 of 1
  1. #1
    Member Deek Fracott's Avatar
    Join Date
    Sep 2012
    Location
    Clarksville, TN
    Posts
    31
    Member #
    33091
    The following code is pretty straight forward: Click the button, and it will call a datastring into my targeted div.

    Code:
    <style type="text/css">
    #output {
        height: 100px;
        width: 300px;
        border: 5px dotted blue;
        }
    </style>
     
    <script language="JavaScript">
    function changeContent() {
    document.getElementById('output').innerHTML="<b>called data</b>";
    }
    </script>
     
    </head><body>
     
    <input type="button" value="Call Data" onClick="changeContent()">
    <div id="output">output div</div>
    Direct and effective. Now, what If I wanted two different buttons to call up two different datasets, id imagine it'd look something like this:

    Code:
    <script language="JavaScript">
    var alpha = function changeContent() {
    document.getElementById('output').innerHTML="Data Set: A";
    }
    var bravo = function changeContent() {
    document.getElementById('output').innerHTML="Data Set: B";
    }
    </script>
    is that correct?
    If so, how would I tweak the input button?

    Code:
    <input type="button" value="Call Data Alpha" onClick="???">
     
    <br>
     
    <input type="button" value="Call Data Bravo" onClick="???">
    <div id="output">output div</div>
    Thanks in advance!

  2.  


Remove Ads

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
All times are GMT -6. The time now is 04:05 PM.
Powered by vBulletin® Version 4.2.3
Copyright © 2019 vBulletin Solutions, Inc. All rights reserved.
vBulletin Skin By: PurevB.com