Warning: file_get_contents(/data/phpspider/zhask/data//catemap/9/javascript/436.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Javascript 我想做一个显示百分比的狗计算器_Javascript_Php_Jquery_Html_Forms - Fatal编程技术网

Javascript 我想做一个显示百分比的狗计算器

Javascript 我想做一个显示百分比的狗计算器,javascript,php,jquery,html,forms,Javascript,Php,Jquery,Html,Forms,以下是我的Index.html代码:- 无标题文件 狗爱计算器 你的狗会用眼睛拥抱你吗? 是 否 可能 你的狗遇到你时会扬起眉毛吗? 是,左一个 不,右一个 否 当你离开家时,他表现出什么样的迹象? 恐慌 冷静 他喜欢睡在哪里? 在他的床上 在你身边或床上 他给你他最喜欢的玩具了吗? 是 否 有时 他对你正在做的事感兴趣吗? 是 否 当你叫你的狗时,你的小狗会很快回你的电话吗? 是 否 你的狗如何在你面前摇尾巴? 右侧 左边 他和你打哈欠吗? 是 否 有时 你的狗如何在你面前移动耳朵?

以下是我的Index.html代码:-


无标题文件
狗爱计算器
你的狗会用眼睛拥抱你吗?


可能

你的狗遇到你时会扬起眉毛吗? 是,左一个
不,右一个


当你离开家时,他表现出什么样的迹象? 恐慌
冷静

他喜欢睡在哪里? 在他的床上
在你身边或床上

他给你他最喜欢的玩具了吗?

有时

他对你正在做的事感兴趣吗?


当你叫你的狗时,你的小狗会很快回你的电话吗?


你的狗如何在你面前摇尾巴? 右侧
左边

他和你打哈欠吗?

有时

你的狗如何在你面前移动耳朵? 移动左耳
移动右耳


为了让您的生活更轻松,您只需在单选按钮中输入%as值即可。 例如:

<input name="yawn" type="radio" value="10" /> <strong>Yes</strong><br />
<input name="yawn" type="radio" value="3" /><strong>No</strong><br />
<input name="yawn" type="radio" value="5" /><strong>Sometimes</strong><br />


有时

您可以在dog2.php中进行计算

为了让您的生活更轻松,只需在单选按钮中输入%as值即可。 例如:

<input name="yawn" type="radio" value="10" /> <strong>Yes</strong><br />
<input name="yawn" type="radio" value="3" /><strong>No</strong><br />
<input name="yawn" type="radio" value="5" /><strong>Sometimes</strong><br />


有时

您可以在dog2.php中进行计算。我做了一个快速测试。这对我有用。你可以复制和玩它

dog.html

     <!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">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Untitled Document</title>
 </head>

 <body>
 <h1>Dog Love Calculator</h1>
<form action="dog2.php" method="post" name="DogCal" onsubmit="return validateForm()" >

<h3>Do Your Dog Hugs you with Eyes?</h3>

<strong><input name="hugs" type="radio" value="10" />Yes</strong><br>
<input name="hugs" type="radio" value="3" /><strong>No</strong><br>
<input name="hugs" type="radio" value="5" /><strong>Maybe</strong><br> <br>

<h3>Does Your Dog Lifts his Eyebrows when Meets You?</h3>
<input name="eyebrows" type="radio" value="10" /><strong>Yes, Left One</strong><br />
<input name="eyebrows" type="radio" value="3" /><strong>No, Right One</strong><br />
<input name="eyebrows" type="radio" value="5" /><strong>No</strong><br /><br>

<h3>What Signs does He show when you Leave Home?</h3>
<input name="signs" type="radio" value="10" /><strong>Panic</strong><br />
<input name="signs" type="radio" value="5" /><strong>Calmness</strong><br /><br>

<h3>Where does he like to sleep?</h3>

<input name="sleep" type="radio" value="10" /><strong>On His Bed</strong><br>
<input name="sleep" type="radio" value="5" /><strong>Beside you or on your bed</strong><br><br>

<h3>Does he Give you His favorite toy?</h3>
<input name="toy" type="radio" value="10" /><strong>Yes</strong><br />
<input name="toy" type="radio" value="3" /><strong>No</strong><br />
<input name="toy" type="radio" value="5" /><strong>Sometimes</strong><br /><br>

<h3>Does he take Interest in what you are doing?</h3>
<input name="interest" type="radio" value="10" /><strong>Yes</strong><br />
<input name="interest" type="radio" value="3" /><strong>No</strong><br /><br>

<h3>When you call your dog, does your pup quickly Returns Your Call?</h3>
<input name="call" type="radio" value="10" /><strong>Yes</strong><br />
<input name="call" type="radio" value="3" /><strong>No</strong><br /><br>

<h3>How Your Dog wags his tail in front of you?</h3>
<input name="tail" type="radio" value="10" /><strong>To the Right</strong><br />
<input name="tail" type="radio" value="3" />a<strong>To the Left</strong><br /><br>

<h3>Does he Yawn With You?</h3>
<input name="yawn" type="radio" value="10" /><strong>Yes</strong><br />
<input name="yawn" type="radio" value="3" /><strong>No</strong><br />
<input name="yawn" type="radio" value="5" /><strong>Sometimes</strong><br /><br>

<h3>How your Dog Move his ears in Front of You? </h3>
<input name="ear" type="radio" value="10" /><strong>Shift The Left Ear</strong><br />
<input name="ear" type="radio" value="3" /><strong>Shift The Right Ear</strong><br /><br>

<input type="submit" name="SubmitButton" value="Submit" >

<input type="reset" value="Reset">
</form>
</body>
</html>

无标题文件
狗爱计算器
你的狗会用眼睛拥抱你吗?


可能

你的狗遇到你时会扬起眉毛吗? 是,左一个
不,右一个


当你离开家时,他表现出什么样的迹象? 恐慌
冷静

他喜欢睡在哪里? 在他的床上
在你身边或床上

他给你他最喜欢的玩具了吗?

有时

他对你正在做的事感兴趣吗?


当你叫你的狗时,你的小狗会很快回你的电话吗?


你的狗如何在你面前摇尾巴? 右侧
左边的a

他和你打哈欠吗?

有时

你的狗如何在你面前移动耳朵? 移动左耳
移动右耳

dog2.php

<?php
$hugs = $_POST['hugs'];
$eyebrows = $_POST['eyebrows'];
$signs = $_POST['signs'];
$sleep = $_POST['sleep'];
$toy = $_POST['toy'];
$interest = $_POST['interest'];
$call = $_POST['call'];
$tail = $_POST['tail'];
$yawn = $_POST['yawn'];
$ear = $_POST['ear'];

echo 'hugs: '.$hugs.'<br>';
echo 'eyebrows: '.$eyebrows.'<br>';
echo 'signs: '.$signs.'<br>';
echo 'sleep: '.$sleep.'<br>';
echo 'toy: '.$toy.'<br>';
echo 'interest: '.$interest.'<br>';
echo 'call: '.$call.'<br>';
echo 'tail: '.$tail.'<br>';
echo 'yawn: '.$yawn.'<br>';
echo 'ear: '.$ear.'<br>';

echo 'total: '.($hugs+$eyebrows+$signs+$sleep+$toy+$interest+$call+$tail+$yawn+$ear);
?>


希望这有帮助。

我做了一个快速测试。这对我有用。你可以复制和玩它

dog.html

     <!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">
 <head>
 <meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
 <title>Untitled Document</title>
 </head>

 <body>
 <h1>Dog Love Calculator</h1>
<form action="dog2.php" method="post" name="DogCal" onsubmit="return validateForm()" >

<h3>Do Your Dog Hugs you with Eyes?</h3>

<strong><input name="hugs" type="radio" value="10" />Yes</strong><br>
<input name="hugs" type="radio" value="3" /><strong>No</strong><br>
<input name="hugs" type="radio" value="5" /><strong>Maybe</strong><br> <br>

<h3>Does Your Dog Lifts his Eyebrows when Meets You?</h3>
<input name="eyebrows" type="radio" value="10" /><strong>Yes, Left One</strong><br />
<input name="eyebrows" type="radio" value="3" /><strong>No, Right One</strong><br />
<input name="eyebrows" type="radio" value="5" /><strong>No</strong><br /><br>

<h3>What Signs does He show when you Leave Home?</h3>
<input name="signs" type="radio" value="10" /><strong>Panic</strong><br />
<input name="signs" type="radio" value="5" /><strong>Calmness</strong><br /><br>

<h3>Where does he like to sleep?</h3>

<input name="sleep" type="radio" value="10" /><strong>On His Bed</strong><br>
<input name="sleep" type="radio" value="5" /><strong>Beside you or on your bed</strong><br><br>

<h3>Does he Give you His favorite toy?</h3>
<input name="toy" type="radio" value="10" /><strong>Yes</strong><br />
<input name="toy" type="radio" value="3" /><strong>No</strong><br />
<input name="toy" type="radio" value="5" /><strong>Sometimes</strong><br /><br>

<h3>Does he take Interest in what you are doing?</h3>
<input name="interest" type="radio" value="10" /><strong>Yes</strong><br />
<input name="interest" type="radio" value="3" /><strong>No</strong><br /><br>

<h3>When you call your dog, does your pup quickly Returns Your Call?</h3>
<input name="call" type="radio" value="10" /><strong>Yes</strong><br />
<input name="call" type="radio" value="3" /><strong>No</strong><br /><br>

<h3>How Your Dog wags his tail in front of you?</h3>
<input name="tail" type="radio" value="10" /><strong>To the Right</strong><br />
<input name="tail" type="radio" value="3" />a<strong>To the Left</strong><br /><br>

<h3>Does he Yawn With You?</h3>
<input name="yawn" type="radio" value="10" /><strong>Yes</strong><br />
<input name="yawn" type="radio" value="3" /><strong>No</strong><br />
<input name="yawn" type="radio" value="5" /><strong>Sometimes</strong><br /><br>

<h3>How your Dog Move his ears in Front of You? </h3>
<input name="ear" type="radio" value="10" /><strong>Shift The Left Ear</strong><br />
<input name="ear" type="radio" value="3" /><strong>Shift The Right Ear</strong><br /><br>

<input type="submit" name="SubmitButton" value="Submit" >

<input type="reset" value="Reset">
</form>
</body>
</html>

无标题文件
狗爱计算器
你的狗会用眼睛拥抱你吗?


可能

你的狗遇到你时会扬起眉毛吗? 是,左一个
不,右一个


当你离开家时,他表现出什么样的迹象? 恐慌
冷静

他喜欢睡在哪里? 在他的床上
在你身边或床上

他给你他最喜欢的玩具了吗?

有时

他对你正在做的事感兴趣吗?


当你叫你的狗时,你的小狗会很快回你的电话吗?


你的狗如何在你面前摇尾巴? 右侧
左边的a

他和你打哈欠吗?

有时

你的狗如何在你面前移动耳朵? 移动左耳
移动右耳

dog2.php

<?php
$hugs = $_POST['hugs'];
$eyebrows = $_POST['eyebrows'];
$signs = $_POST['signs'];
$sleep = $_POST['sleep'];
$toy = $_POST['toy'];
$interest = $_POST['interest'];
$call = $_POST['call'];
$tail = $_POST['tail'];
$yawn = $_POST['yawn'];
$ear = $_POST['ear'];

echo 'hugs: '.$hugs.'<br>';
echo 'eyebrows: '.$eyebrows.'<br>';
echo 'signs: '.$signs.'<br>';
echo 'sleep: '.$sleep.'<br>';
echo 'toy: '.$toy.'<br>';
echo 'interest: '.$interest.'<br>';
echo 'call: '.$call.'<br>';
echo 'tail: '.$tail.'<br>';
echo 'yawn: '.$yawn.'<br>';
echo 'ear: '.$ear.'<br>';

echo 'total: '.($hugs+$eyebrows+$signs+$sleep+$toy+$interest+$call+$tail+$yawn+$ear);
?>


希望这能有所帮助。

有太多的话要说。。。1.使用HTML5。2.请缩进。3.因此,它不是一个代码提供工具,我们会在您遇到bug时提供帮助。这个问题太宽泛了。3.“我想要一个狗计算器”->太好了,我们为你高兴。毫无疑问。4.欢迎来到SO!有那么多事情要说。。。1.使用HTML5。2.请缩进。3.因此,它不是一个代码提供工具,我们会在您遇到bug时提供帮助。这个问题太宽泛了。3.“我想要一个狗计算器”->太好了,我们为你高兴。毫无疑问。4.欢迎来到SO!已尝试,但如何计算单击哪个选项?我试过这个$hugs=$\u POST[“hugs”]$眉毛=$_POST[“眉毛”]$符号=$_POST[“符号”]$sleep=$\u POST[“sleep”]$玩具=$_POST[“玩具”]$利息=$_POST[“利息”]$call=$\u POST[“call”]$tail=$_POST[“tail”]$哈欠=$_POST[“哈欠”]$ear=$_POST[“ear”]$总计=$拥抱+$眉毛+$手势+$睡眠+$玩具+$兴趣+$呼叫+$尾巴+$打哈欠+$耳朵;我认为你的php是正确的,但它不起作用。。这是唯一的优先选择。。如果我们选择任何其他选项,输出是一个空白页面,但如何计算单击哪个选项?我试过这个$hugs=$\u POST[“hugs”]$眉毛=$_POST[“眉毛”]$符号=$_