Team:Shenzhen/Temp/nav.htm
From 2012.igem.org
(Difference between revisions)
(Created page with "<!---------------------- Title: display.css Team: Shenzhen Author: BGI_K2 Twitter: @BGI_K2 Email: im.ss.kk@gmail.com Please contact me if you would like to use this script...") |
|||
Line 13: | Line 13: | ||
<html lang="en"> | <html lang="en"> | ||
+ | |||
+ | <script type="text/javascript"> | ||
+ | |||
+ | // 获得IE和firefox浏览器中的XMLHttpRequest对象 | ||
+ | function getXMLHTTPRequest() | ||
+ | { | ||
+ | var myRequest = null; | ||
+ | if(window.XMLHttpRequest) // firefox | ||
+ | { | ||
+ | myRequest = new XMLHttpRequest(); | ||
+ | } | ||
+ | else if(typeof ActiveXObject != "#ff0000") // IE | ||
+ | { | ||
+ | myRequest = new ActiveXObject("Microsoft.XMLHTTP"); | ||
+ | } | ||
+ | return myRequest; | ||
+ | } | ||
+ | |||
+ | var myRequest; | ||
+ | function onReadyState() // XMLHttpRequest处理异步访问状态时的事件 | ||
+ | { | ||
+ | if(myRequest.readyState == 4) // 4表示成功获得相应信息 | ||
+ | { | ||
+ | var msg = document.getElementById("msg"); | ||
+ | msg.value = myRequest.responseText | ||
+ | } | ||
+ | } | ||
+ | function getServiceText() | ||
+ | { | ||
+ | myRequest = getXMLHTTPRequest(); | ||
+ | if(myRequest) | ||
+ | { | ||
+ | myRequest.onreadystatechange = onReadyState; | ||
+ | try | ||
+ | { | ||
+ | myRequest.open( "post", "http://www.blogjava.net", true); | ||
+ | } | ||
+ | catch(exception) | ||
+ | { | ||
+ | var msg = document.getElementById("msg"); | ||
+ | msg.value = exception; | ||
+ | } | ||
+ | myRequest.send("test"); | ||
+ | } | ||
+ | } | ||
+ | |||
+ | </script> | ||
<link rel="stylesheet" type="text/css" href="http://www.k2s.me/igem/css/navbutton.css" /> | <link rel="stylesheet" type="text/css" href="http://www.k2s.me/igem/css/navbutton.css" /> | ||
Line 102: | Line 149: | ||
</div> | </div> | ||
<script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | <script type="text/javascript" src="http://ajax.googleapis.com/ajax/libs/jquery/1.6.4/jquery.min.js"></script> | ||
+ | |||
+ | <input id="msg" type="text" /> | ||
+ | <input type="button" value="信息" onclick="getServiceText()" /> | ||
+ | |||
</body> | </body> | ||
</html> | </html> |
Revision as of 15:58, 17 August 2012