ตอนนี้กำลังหัดเขียนJavascriptและตอนนี้ผมติดปัญหาการแสดงคำตอบในแบบฟอร์มเพราะผมต้องการจะนำเลข2ตัวในช่องบนที่วงด้วยสีฟ้าไปคูณกันที่ปุ่มsubmitจนเด้งpop-upขึ้นมาเป็นผลลัพธ์ในวงกลมน้ำตาลแต่พอจะนำข้อความในpop-upไปแสดงต่อยังไงก็ได้ที่พื้นที่ข้างล่าง(วงกลมสีส้ม)กลับไม่สามารถหาวิธีที่เหมาะสมได้ครับ วานผู้ที่ถนัดJavascriptช่วยแนะนำขั้นตอนที่ถูกวิธีครับ
ภาพประกอบ:
ตัวโค้ดครับ:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style2.css">
<script type="text/javascript">
function Multiplication()
{
var Baht = document.form.txtBaht.value;
var Dollars = document.form.txtDollars.value;
var sum = Number(Baht) * Number(Dollars);
alert("Your result " + "= " +Baht+"*"+Dollars+"="+sum);
}
function Restart() {
alert("Enter again!!");
}
</script>
</head>
<body>
<div id="header"><h1><B>GTA video forum!!</B></h1></div>
<div id="left"><ul class="x">
<li id="home">Home</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Profile.html">Profile</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Missions.html">Games</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Weapons.html">Weapons</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Vehicles.html">Vehicles</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Cheats.html">Cheats</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/EasterEggs.html">Easter</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Questions.html">Q&A</a></li>
</ul></div>
<div id="content">
<table align="center" cellpadding="20" width="800" height="250">
<tbody>
<tr>
<th class="ha1" align="left">TABLE 1</th>
</tr>
<tr>
<td>
<form name="form">
<div style="width:400px; height:150px;">
<div style="width:300px; height:40px;">
<div style="width:150px; height:30px; float:left" >Enter Baht: </div>
<div style="width:150px; height:30px; float:left" ><input type="number" name="txtBaht"> </div>
</div>
<div style="width:300px; height:40px;">
<div style="width:150px; height:30px; float:left" >Enter Dollars: </div>
<div style="width:150px; height:30px; float:left" ><input type="number" name="txtDollars"></div>
</div>
<div style="width:400px; height:40px;">
<center><input type="submit" value="Submit" onclick="Multiplication(txtBaht.value,txtDollars.value);">
<input type="reset" value="Reset" onclick="Restart();"></center>
</div>
</form>
</td>
</tr>
</tbody>
</table>
<table align="center" cellpadding="20" width="800" height="250">
<tbody>
<tr>
<th class="ha2" align="left" colspan="4">TABLE 2</th>
</tr>
<tr>
<td>
x1
</td>
<td>
x2
</td>
<td>
x3
</td>
<td>
x4
</td>
</tr>
<tr>
<td>
x5
</td>
<td>
x6
</td>
<td>
x7
</td>
<td>
x8
</td>
</tr>
<tr>
<td>
x9
</td>
<td>
x10
</td>
<td>
x11
</td>
<td>
x12
</td>
</tr>
<tr>
<td class="ct" colspan="2">
</td>
<td >
x13
</td>
<td>
x14
</td>
</tr>
</tbody>
</table>
<table align="center" cellpadding="20" width="800" height="250">
<col width="200">
<col width="200">
<col width="200">
<col width="200">
<tbody>
<tr>
<th class="ha3" align="left" colspan="4">GTA 3D-Universe 's main clips</th>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/BfP3wxXWsuU"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/rudmEUyf_vM"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/IbwAUTiDpdg"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/oKt7zTY2Ye8"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/l9E7pPHuSvE"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/Az89VVFPDVY"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/TXWmyHua7fk"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/b13SUnoHa0Y"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/_T7-v_as870"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/wy95d3TrAIQ"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/wTXvxkpQUtw"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/giSsfPRW908"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/FcbLcA2Pk2Y"></iframe></td >
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/A4OzS4gnyhE"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/OBTj0RYuAJ8"></iframe></td>
<td height="190"><iframe width="200" height="175" src="
https://www.youtube.com/embed/LuWTpvqdQOI"></iframe></td>
</tr>
</tbody>
</table>
</div>
<div id="footer">
<center>
<p>
<img src="
https://www.w3.org/2009/Talks/witfor-web20/w3c-logo.png" width="50" height="50" alt="W3" >
<p class="conclusion">This website have been developed and appeared since Friday,8 July 2016</p>
</p>
</center>
</div>
</body>
</html>
ปัญหาการแสดงผลลัพธ์ข้างล่างพร้อมpop-upครับทางJavaScript
ภาพประกอบ:
ตัวโค้ดครับ:
<!DOCTYPE html>
<html>
<head>
<link rel="stylesheet" type="text/css" href="style2.css">
<script type="text/javascript">
function Multiplication()
{
var Baht = document.form.txtBaht.value;
var Dollars = document.form.txtDollars.value;
var sum = Number(Baht) * Number(Dollars);
alert("Your result " + "= " +Baht+"*"+Dollars+"="+sum);
}
function Restart() {
alert("Enter again!!");
}
</script>
</head>
<body>
<div id="header"><h1><B>GTA video forum!!</B></h1></div>
<div id="left"><ul class="x">
<li id="home">Home</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Profile.html">Profile</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Missions.html">Games</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Weapons.html">Weapons</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Vehicles.html">Vehicles</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Cheats.html">Cheats</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/EasterEggs.html">Easter</a></li>
<li><a href="file:///C:/Users/PATTANA/Desktop/Questions.html">Q&A</a></li>
</ul></div>
<div id="content">
<table align="center" cellpadding="20" width="800" height="250">
<tbody>
<tr>
<th class="ha1" align="left">TABLE 1</th>
</tr>
<tr>
<td>
<form name="form">
<div style="width:400px; height:150px;">
<div style="width:300px; height:40px;">
<div style="width:150px; height:30px; float:left" >Enter Baht: </div>
<div style="width:150px; height:30px; float:left" ><input type="number" name="txtBaht"> </div>
</div>
<div style="width:300px; height:40px;">
<div style="width:150px; height:30px; float:left" >Enter Dollars: </div>
<div style="width:150px; height:30px; float:left" ><input type="number" name="txtDollars"></div>
</div>
<div style="width:400px; height:40px;">
<center><input type="submit" value="Submit" onclick="Multiplication(txtBaht.value,txtDollars.value);">
<input type="reset" value="Reset" onclick="Restart();"></center>
</div>
</form>
</td>
</tr>
</tbody>
</table>
<table align="center" cellpadding="20" width="800" height="250">
<tbody>
<tr>
<th class="ha2" align="left" colspan="4">TABLE 2</th>
</tr>
<tr>
<td>
x1
</td>
<td>
x2
</td>
<td>
x3
</td>
<td>
x4
</td>
</tr>
<tr>
<td>
x5
</td>
<td>
x6
</td>
<td>
x7
</td>
<td>
x8
</td>
</tr>
<tr>
<td>
x9
</td>
<td>
x10
</td>
<td>
x11
</td>
<td>
x12
</td>
</tr>
<tr>
<td class="ct" colspan="2">
</td>
<td >
x13
</td>
<td>
x14
</td>
</tr>
</tbody>
</table>
<table align="center" cellpadding="20" width="800" height="250">
<col width="200">
<col width="200">
<col width="200">
<col width="200">
<tbody>
<tr>
<th class="ha3" align="left" colspan="4">GTA 3D-Universe 's main clips</th>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/BfP3wxXWsuU"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/rudmEUyf_vM"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/IbwAUTiDpdg"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/oKt7zTY2Ye8"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/l9E7pPHuSvE"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/Az89VVFPDVY"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/TXWmyHua7fk"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/b13SUnoHa0Y"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/_T7-v_as870"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/wy95d3TrAIQ"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/wTXvxkpQUtw"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/giSsfPRW908"></iframe></td>
</tr>
<tr>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/FcbLcA2Pk2Y"></iframe></td >
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/A4OzS4gnyhE"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/OBTj0RYuAJ8"></iframe></td>
<td height="190"><iframe width="200" height="175" src="https://www.youtube.com/embed/LuWTpvqdQOI"></iframe></td>
</tr>
</tbody>
</table>
</div>
<div id="footer">
<center>
<p>
<img src="https://www.w3.org/2009/Talks/witfor-web20/w3c-logo.png" width="50" height="50" alt="W3" >
<p class="conclusion">This website have been developed and appeared since Friday,8 July 2016</p>
</p>
</center>
</div>
</body>
</html>