Saturday, January 17, 2015

Creating Answer Button

For creating Answer Button you follow the below script that can help you create Answer Button. Here you look. You can write your question between it( <p> .........................<p> ) that's marked as red.
Then you have to write Answer between this blank place(<button onclick="myFunction()">.........</button>). Besides, you also have to set the answer of the question between <script>..........</script>. That instead of Wordsworth you can set your own answer. Better to say, you must notice that <p id and getElementById should be same. If the both ids are different, this button will not work. Thus you can create your Answer Button with Java Script.


<!DOCTYPE html>
<html>
<body>

<p>01.Who is called nature poet?</p>

<button onclick="myFunction()">Answer</button>

<p id="10001"></p>

<script>
function myFunction() {
    document.getElementById("10001").innerHTML =
    "Wordsworth ";
}
</script>

</body>
</html>

No comments:

Post a Comment

Contact

Name

Email *

Message *