如何让用户在Facebook上分享他的分数...用户应该只能在分享后才能看到他的分数。用户应该能够分享点击然后它应该显示他的分数。
我已经附加了我的HTML代码,当用户点击正确的答案时,用户得分,我如何在facebbok中分享。
<body>
<li id="q" style="font-size:16px;">A man is very hungry. His stomach is absolutely empty. He have infinite chocolates with him.The man will be killed after 10 minutes.He started eating the chocolates one by one hurriedly. How many chocolates can that 80 kg weighed man eat in his absolutely empty stomach?(your answer should not be in decimal or fraction) </li>
<ul style="margin-left">
<li>a). <input name="q1" type="radio" value="1">10</input></li>
<li>b). <input name="q1" type="radio" value="2">0</input></li>
<li>c). <input name="q1" type="radio" value="3">Vary from person to person</input><li>
<li>d). <input name="q1" type="radio" value="4">1</input></li>
<li>e). <input name="q1" type="radio" value="5">48</input></li>
</ul>
<p id="ans1" style="margin-left:20%; color:red;"></p>
<li id="q" style="font-size:16px;"> In what year did Christmas and New Year's fall in the same year? </li>
<ul style="margin-left">
<li>a). <input name="q2" type="radio" value="1">Impossible</input></li>
<li>b). <input name="q2" type="radio" value="2">1979</input></li>
<li>c). <input name="q2" type="radio" value="3">Before BC</input><li>
<li>d). <input name="q2" type="radio" value="4">Every year</input></li>
<li>e). <input name="q2" type="radio" value="5">None of these</input></li>
</ul>
<p id="ans2" style="margin-left:20%; color:red;"></p>
<li id="q" style="font-size:16px;">How could you rearrange the letters in the words "new door" to make one word? Note: There is only one correct answer. </li>
<br><input type="text" id="q3">
<p id="ans2" style="margin-left:20%; color:red;"></p>
<li id="q" style="font-size:16px;">If 1/2 of 5x is 3, then what is 1/3 of 10x? </li>
<ul style="margin-left">
<li>a). <input name="q4" type="radio" value="1">3</input></li>
<li>b). <input name="q4" type="radio" value="2">4</input></li>
<li>c). <input name="q4" type="radio" value="3">5</input></li>
</ul>
<li id="q" >What number do you get when you multiply all of the numbers on a telephone's number pad?</li>
<ul>
<li>a). <input name="q5" type="radio" value="1">46758,890</input></li>
<li>b). <input name="q5" type="radio" value="2">340,000</input></li>
<li>c). <input name="q5" type="radio" value="3">0</input></li>
<li>d). <input name="q5" type="radio" value="4">None of these</input></li>
</ul>
<li id="q">John has been hired to paint the numbers 1 through 100 on 100 apartments. How many times will he have to paint 8?</li>
<ul>
<li>a). <input name="q6" type="radio" value="1">20</input><li>
<li>b). <input name="q6" type="radio" value="2">18</input><li>
<li>c). <input name="q6" type="radio" value="3">19</input><li>
</ul>
<li id="q">What is the difference between a dollar and a half and thirty five-cents?</li>
<ul> <li>a). <input name="q7" type="radio" value="1">1 dollar 15 cents</input></li>
<li>b). <input name="q7" type="radio" value="2">15 cents</input></li>
<li>c). <input name="q7" type="radio" value="3">85 cents></input></li>
</ul>
<li id="q">3,54,204,461,833,1328,1954,?</li>
<ul>
<li>a). <input name="q8" type="radio" value="1">2808</input></li>
<li>b). <input name="q8" type="radio" value="2">2708</input></li>
<li>c). <input name="q8" type="radio" value="3">2789</input></li>
<li>d). <input name="q8" type="radio" value="4">2719</input></li>
<li>e). <input name="q8" type="radio" value="5">2706</input></li>
</ul>
<li id="q">If all Bloops are Razzies and all Razzies are Lazzies, then are all Bloops definitely Lazzies?</li>
<ul>
<li>a). <input name="q9" type="radio" value="1">yes</input></li>
<li>b). <input name="q9" type="radio" value="2">no</input></li>
<li>c). <input name="q9" type="radio" value="3">None of these</input></li>
</ul>
<li id="q">Mary, who is sixteen years old, is four times as old as her brother. How old will Mary be when she is twice as old as her brother?</li>
<ul>
<li>a). <input name="q10" type="radio" value="1">8</input></li>
<li>b). <input name="q10" type="radio" value="2">25</input></li>
<li>c). <input name="q10" type="radio" value="3">12</input></li>
<li>d). <input name="q10" type="radio" value="4">24</input></li>
<li>e). <input name="q10" type="radio" value="5">26</input></li>
</ul>
</ol>
<input type="submit" name="submit" value="submit"/>
<button onclick="return score()">Show answers</button>
<script type="text/javascript">
function answer()
{
document.getElementById('ans1').innerHTML="1 , he can eat only one with absolutely empty stomache";
document.getElementById('ans2').innerHTML="Every year, new year in the start and christmas at the end of an year";
}
function score()
{
var score=0;
var q1=$("input[type='radio'][name='q1']:checked").val();
var q2=$("input[type='radio'][name='q2']:checked").val();
var q3=$('#q3').val();
var q4=$("input[type='radio'][name='q4']:checked").val();
var q5=$("input[type='radio'][name='q5']:checked").val();
var q6=$("input[type='radio'][name='q6']:checked").val();
var q7=$("input[type='radio'][name='q7']:checked").val();
var q8=$("input[type='radio'][name='q8']:checked").val();
var q9=$("input[type='radio'][name='q9']:checked").val();
var q10=$("input[type='radio'][name='q10']:checked").val();
if(q1==4)
{
score++;
};
if(q2==4)
{
score++;
};
if(q3=='one word')
{
score++;
};
if(q4==2)
{
score++;
};
if(q5==3)
{
score++;
};
if(q6==1)
{
score++;
};
if(q7==1)
{
score++;
};
if(q8==4)
{
score++;
};
if(q9==1)
{
score++;
};
if(q10==4)
{
score++;
};
alert("score is "+score);
}
<style type="text/css">
#q{
margin-top: 2%;
}
ul,input[type="text"]
{
margin-left: 10%;
}
input[type="text"]
{
width:30%;
background:#ebe4c2;
color: #000;
}
</style>
</body>