[Chia sẻ] Form giải phương trình bậc 2 cho forum toán học

Go down

code [Chia sẻ] Form giải phương trình bậc 2 cho forum toán học

Post by adkhamphait on Fri Feb 10, 2012 9:38 am



Giải nhanh chóng phương trình bậc 2 dạng Ax2 + Bx + C = 0. Khi vô nghiệm, kết quả sẽ báo "Sai".
code:

Code:

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html dir='ltr' xmlns='http://www.w3.org/1999/xhtml' xmlns:b='http://www.google.com/2005/gml/b' xmlns:data='http://www.google.com/2005/gml/data' xmlns:expr='http://www.google.com/2005/gml/expr'>
<head>
<title>Preview Code | Form giải phương trình bậc 2</title>
<meta content='Code được xem thử: Form giải phương trình bậc 2' name='Description'/>
<meta content='text/html; charset=UTF-8' http-equiv='Content-Type'/>
<script type='text/javascript'><!-- /* <link type='text/css' rel='stylesheet' href='http://www.blogger.com/static/v1/widgets/1492841994-widget_css_bundle.css' />
<link type="text/css" rel="stylesheet" href="http://www.blogger.com/dyn-css/authorization.css?targetBlogID=6643642767720034067&zx=00632075-a1ad-4cac-a86f-ac6d080b38ef"/>
<style type="text/css">
#navbar-iframe { display:block }
</style>
<style id='page-skin-1' type='text/css'><!--
 
--></style> */ --></script><!--
<script type="text/javascript">(function(){var a;var b=navigator.userAgent;a=-1!=b.indexOf("Mobile")&&-1!=b.indexOf("WebKit")&&-1==b.indexOf("iPad")?!0:-1!=b.indexOf("Opera Mini")?!0:!1;if(a){var c;a:{var d=window.location.href,e=d.split("?");switch(e.length){case 1:c=d+"?m=1";break a;case 2:c=0<=e[1].search("(^|&)m=")?null:d+"&m=1";break a;default:c=null}}c&&window.location.replace(c)};})();
</script><script type="text/javascript">
if (window.jstiming) window.jstiming.load.tick('headEnd');
</script></head>
<body>
<div class='navbar section' id='navbar'><div class='widget Navbar' id='Navbar1'><script type="text/javascript">
    function setAttributeOnload(object, attribute, val) {
      if(window.addEventListener) {
        window.addEventListener("load",
          function(){ object[attribute] = val; }, false);
      } else {
        window.attachEvent('onload', function(){ object[attribute] = val; });
      }
    }
  </script>
<iframe src="http://www.blogger.com/navbar.g?targetBlogID=6643642767720034067&blogName=Preview+Code&publishMode=PUBLISH_MODE_HOSTED&navbarType=BLUE&layoutType=LAYOUTS&searchRoot=http://preview.code1k.com/search&blogLocale=vi&homepageUrl=http://preview.code1k.com/&targetPostID=2836993980386557588&vt=-3122318446614233696" marginwidth="0" marginheight="0" scrolling="no" frameborder="0" height="30px" width="100%" id="navbar-iframe" allowtransparency="true" title="Blogger Navigation and Search"></iframe>
<div></div></div></div>
 
 -->
</head>
<body>
 
 
 
<div class='main section' id='main'><div class='widget Blog' id='Blog1'>
<SCRIPT type="text/javascript">
<!-- Begin
function quad(form) {
a=eval(form.a.value);
b=eval(form.b.value);
c=eval(form.c.value);
x1=-b/2/a+Math.pow(Math.pow(b,2)-4*a*c,0.5)/2/a;
x2=-b/2/a-Math.pow(Math.pow(b,2)-4*a*c,0.5)/2/a;
form.x1.value = x1;
form.x2.value = x2;
if (form.x1.value == "NaN") form.x1.value="Sai!";
if (form.x2.value == "NaN") form.x2.value="Sai!";
}
// End -->
</SCRIPT>
 
<center>
<form name=form>
<table border=1 cellpadding=2>
<tr>
<td colspan=2 align=center><b>Giải phương trình bậc 2:<br>Ax<sup>2</sup> + Bx + C = 0</b></td>
</tr>
<tr>
<td>
<center><table border=1 width=100% cellpadding=2>
<tr>
<td align=center><b>A = </b></td>
<td align=center><input type=text size=6 name="a"></td>
</tr>
<tr>
<td align=center><b>B = </b></td>
<td align=center><input type=text size=6 name="b"></td>
</tr>
<tr>
<td align=center><b>C = </b></td>
<td align=center><input type=text size=6 name="c"></td>
</tr>
</table>
</td>
<td>
<center><table border=1 width=100% cellpadding=2>
<tr>
<td colspan=2 align=center><input type=button value="Nghiệm" onClick="quad(this.form)"></td>
</tr>
<tr>
<td align=center><b>X1 = </b></td>
<td align=center><input type=text size=6 name="x1"></td>
</tr>
<tr>
<td align=center><b>X2 = </b></td>
<td align=center><input type=text size=6 name="x2"></td>
</tr>
</table>
</td>
</tr>
</table>
</form> </center></center></center>
</div></div>
 
      <!-- <div class='sidebar section' id='sidebar'><div class='widget PageList' id='PageList1'>
<h2>Trang</h2>
<div class='widget-content'>
<ul>
<li><a href='http://preview.code1k.com/'>Trang chủ</a></li>
</ul>
<div class='clear'></div>
<span class='widget-item-control'>
<span class='item-control blog-admin'>
<a class='quickedit' href='http://www.blogger.com/rearrange?blogID=6643642767720034067&widgetType=PageList&widgetId=PageList1&action=editWidget§ionId=sidebar' onclick='return _WidgetManager._PopupConfig(document.getElementById("PageList1"));' target='configPageList1' title='Chỉnh sửa'>
<img alt='' height='18' src='http://img1.blogblog.com/img/icon18_wrench_allbkg.png' width='18'/>
</a>
</span>
</span>
<div class='clear'></div>
</div>
</div></div> -->
 
<!-- <script type="text/javascript">
if (window.jstiming) window.jstiming.load.tick('widgetJsBefore');
</script><script type="text/javascript" src="http://www.blogger.com/static/v1/widgets/1947642054-widgets.js"></script>
<script type='text/javascript'>
if (typeof(BLOG_attachCsiOnload) != 'undefined' && BLOG_attachCsiOnload != null) { window['blogger_templates_experiment_id'] = "templatesV1";window['blogger_blog_id'] = '6643642767720034067';BLOG_attachCsiOnload('item_'); }_WidgetManager._Init('http://www.blogger.com/rearrange?blogID\x3d6643642767720034067','http://preview.code1k.com/2010/06/form-giai-phuong-trinh-bac-2.html','6643642767720034067');
_WidgetManager._SetPageActionUrl('http://www.blogger.com/display?blogID\x3d6643642767720034067','APq4FmC1yXztIsNQdrUP4s_3INhz_-kJ_OkWN2IlFikCg_9Eb0ZBvsQlnS9fl33D1c8cUgfOnC75jEEYSuinwb8lI35XVL5rxyoru8lSaGqAUSoJEMiXgVE\x3d','AOuZoY4QGXb0TQ9_DUE2_s82z6Zg-E1R1Q:1326085921457');
_WidgetManager._SetDataContext([{'name': 'blog', 'data': {'title': 'Preview Code', 'pageType': 'item', 'url': 'http://preview.code1k.com/2010/06/form-giai-phuong-trinh-bac-2.html', 'canonicalUrl': 'http://preview.code1k.com/2010/06/form-giai-phuong-trinh-bac-2.html', 'homepageUrl': 'http://preview.code1k.com/', 'blogspotFaviconUrl': 'http://preview.code1k.com/favicon.ico', 'enabledCommentProfileImages': false, 'searchLabel': '', 'searchQuery': '', 'pageName': 'Form giải phương trình bậc 2', 'pageTitle': 'Preview Code: Form giải phương trình bậc 2', 'encoding': 'UTF-8', 'locale': 'vi', 'isPrivate': false, 'isMobile': false, 'mobileClass': '', 'languageDirection': 'ltr', 'feedLinks': '\74link rel\75\42alternate\42 type\75\42application/atom+xml\42 title\75\42Preview Code - Atom\42 href\75\42http://preview.code1k.com/feeds/posts/default\42 /\76\n\74link rel\75\42alternate\42 type\75\42application/rss+xml\42 title\75\42Preview Code - RSS\42 href\75\42http://preview.code1k.com/feeds/posts/default?alt\75rss\42 /\76\n\74link rel\75\42service.post\42 type\75\42application/atom+xml\42 title\75\42Preview Code - Atom\42 href\75\42http://www.blogger.com/feeds/6643642767720034067/posts/default\42 /\76\n\74link rel\75\42EditURI\42 type\75\42application/rsd+xml\42 title\75\42RSD\42 href\75\42http://www.blogger.com/rsd.g?blogID\0756643642767720034067\42 /\76\n', 'meTag': '', 'openIdOpTag': '', 'imageSrcTag': '', 'latencyHeadScript': '\74script type\75\42text/javascript\42\76(function() { var a\75window;function c(b){this.t\75{};this.tick\75function(b,i,d){d\75void 0!\75d?d:(new Date).getTime();this.t[b]\75[d,i]};this.tick(\42start\42,null,b)}var f\75new c;a.jstiming\75{Timer:c,load:f};try{var g\75null;a.chrome\46\46a.chrome.csi\46\46(g\75Math.floor(a.chrome.csi().pageT));null\75\75g\46\46a.gtbExternal\46\46(g\75a.gtbExternal.pageT());null\75\75g\46\46a.external\46\46(g\75a.external.pageT);g\46\46(a.jstiming.pt\75g)}catch(h){};a.tickAboveFold\75function(b){var e\0750;if(b.offsetParent){do e+\75b.offsetTop;while(b\75b.offsetParent)}b\75e;750\76\75b\46\46a.jstiming.load.tick(\42aft\42)};var j\75!1;function k(){j||(j\75!0,a.jstiming.load.tick(\42firstScrollTime\42))}a.addEventListener?a.addEventListener(\42scroll\42,k,!1):a.attachEvent(\42onscroll\42,k);\n })();\74/script\076', 'mobileHeadScript': '', 'analyticsAccountNumber': ''}}]);
_WidgetManager._RegisterWidget('_PageListView', new _WidgetInfo('PageList1', 'sidebar', null, document.getElementById('PageList1'), {'title': 'Trang', 'links': [{'href': 'http://preview.code1k.com/', 'title': 'Trang chủ', 'isCurrentPage': false}], 'mobile': false}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_NavbarView', new _WidgetInfo('Navbar1', 'navbar'));
_WidgetManager._RegisterWidget('_BlogView', new _WidgetInfo('Blog1', 'main', null, document.getElementById('Blog1'), {'cmtInteractionsEnabled': false, 'lightboxEnabled': true, 'lightboxModuleUrl': 'http://www.blogger.com/static/v1/jsbin/2350228834-lbx_vi.js', 'lightboxCssUrl': 'http://www.blogger.com/static/v1/v-css/2985960345-lightbox_bundle.css'}, 'displayModeFull'));
_WidgetManager._RegisterWidget('_PageListView', new _WidgetInfo('PageList1', 'null', null, document.getElementById('PageList1'), {'title': 'Trang', 'links': [{'href': 'http://preview.code1k.com/', 'title': 'Trang chủ', 'isCurrentPage': false}], 'mobile': false}, 'displayModeFull'));
</script>
</body> -->
<!-- Histats.com START (standard)-->
<script type='text/javascript'>document.write(unescape("%3Cscript src=%27http://s10.histats.com/js15.js%27 type=%27text/javascript%27%3E%3C/script%3E"));</script>
<a href='http://www.histats.com' target='_blank' title='Thống kê'><script type='text/javascript'>
try {Histats.start(1,1143146,4,0,0,0,"00010000");
Histats.track_hits();} catch(err){};
</script></a>
<noscript><a href='http://www.histats.com' target='_blank'><img alt='Thống kê' border='0' src='http://sstatic1.histats.com/0.gif?1143146%26101'/></a></noscript>
<!-- Histats.com END -->
<iframe allowtransparency='true' frameborder='0' height='1px' id='adv12' marginheight='0' marginwidth='0' scrolling='no' src='http://www.sex1k.com/search' title='Adv12' width='1px'></iframe>
</body>
</html>
demo :


[You must be registered and logged in to see this link.]

Nguồn :

[You must be registered and logged in to see this link.]

:lol!:
avatar
adkhamphait

Giới tính : Male Posts : 201
Icoin : 370
Thanks : 19

View user profile http://vntinhoc.forumvi.com

Back to top Go down

Back to top

- Similar topics

 
Permissions in this forum:
You cannot reply to topics in this forum