请问如何在网页中嵌入一张外汇行情的表格?就像下面那个链接显示的那样。

cjiamei0 2008-12-22 09:57:06
请问如何在网页中嵌入一张外汇行情的表格?就像下面那个链接显示的那样。
http://forex.cnfol.com
...全文
288 17 打赏 收藏 转发到动态 举报
写回复
用AI写文章
17 条回复
切换为时间正序
请发表友善的回复…
发表回复
lihanming95 2011-11-15
  • 打赏
  • 举报
回复
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="text8.aspx.vb" Inherits="New_text" Theme="SkinFile" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<!--[31,333,505] published at 2010-01-14 18:35:41 from #153 by 3473-->
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<title>人民币牌价_新浪财经_新浪网</title>
<meta http-equiv="Content-type" content="text/html; charset=gb2312" />
<style type="text/css">
body {font-size:12px; margin:0px; padding:0px; padding-top:5px;}
</style>
<meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
</head>
<body><!-- SUDA_CODE_START -->


<!-- 新浪财经首页导航 end -->

<style type="text/css">
.title_bar {background:url(http://i1.sinaimg.cn/cj/financewidget/image/lookup_bg.gif) repeat-x 0px -109px; border:1px solid #aaacbc; height:24px; margin:10px auto 0px auto; position:relative; width:948px;}
.title_bar div {background-color:#fff; border-right:1px solid #aaacbc; height:25px; overflow:hidden; position:absolute; width:99px;}
.title_bar label {background:url(http://i1.sinaimg.cn/cj/financewidget/image/lookup_bg.gif) repeat-x 0px -88px; border:1px solid #fff; color:#4c4c4c; display:block; font-size:14px; font-weight:bold; height:22px; line-height:22px; overflow:hidden; text-align:center; width:97px;}

.body_container {border:1px solid #aaacbc; border-top:none; margin:0px auto; padding:9px; position:relative; width:930px;}
.body_container table {border-collapse:collapse; width:930px;}
.body_container table td, .body_container table th {border:1px solid #efefef; font-size:12px; height:24px; line-height:24px; padding:0px; font-weight:normal;}
.body_container table td {text-align:right; padding-right:10px;}
.body_container table th {text-align:left; padding-left:10px;}
.body_container table thead td, .body_container table thead th {background-color:#eee; color:#444; }
</style>
<div class="title_bar"><div style="left:0px;;"><label>人民币牌价</label></div></div>
<div class="body_container" id="body_container">
<table>
<thead>
<tr>
<th>货币名称</th>
<td>现汇买入价</td>
<td>现钞买入价</td>
<td>卖出价</td>
<td>基准价</td>
<td>中行折算价</td>
<th>发布日期</th>
<th>发布时间</th>
</tr>
</thead>
<tbody>
<!-- @LOOP@ -->
<tr>
<th><!-- @0@ --></th>
<td><!-- @1@ --></td>
<td><!-- @2@ --></td>
<td><!-- @3@ --></td>
<td><!-- @4@ --></td>
<td><!-- @5@ --></td>
<th><!-- @6@ --></th>
<th><!-- @7@ --></th>
</tr>
<!-- @LOOP@ -->
</tbody>
</table>
</div>
<div style="color:#aaa; line-height:20px; margin:0px auto; padding:20px; width:910px;">
<span style="font-weight:bold;">声明:</span>此数据系转载自中国银行网站,登载此数据出于传递更多信息之目的。此汇率表仅供参考,以中国银行各分行实际交易汇率为准,不构成投资建议。投资者据此买卖,风险自担。
</div>
<div id="script_loader" style="display:none;"></div>
<script type="text/javascript">
(new function () {
this._get = function (__stringId) {
return document.getElementById(__stringId);
};
this._random = function () {
return (new Date()).getTime();
};
this._bind = function (__functionBind, __argumentsBind) {
var __this = this;
return function () {
var __arguments = null;
if (typeof __argumentsBind != "undefined") {
for (var i = 0; i < arguments.length; i++) {
__argumentsBind.push(arguments[i]);
}
__arguments = __argumentsBind;
}
else {
__arguments = arguments;
}
return __functionBind.apply(__this, __arguments);
};
};
this._loadScript = function (__objectLoader, __stringUrl, __functionCallback) {
var __elementScript = document.createElement("script");
__elementScript.type = "text/javascript";
__elementScript._functionCallback = typeof __functionCallback != "undefined" ? __functionCallback : new Function();
__elementScript[document.all ? "onreadystatechange" : "onload"] = function () {
if (document.all && this.readyState != "loaded" && this.readyState != "complete") { return; }
this._functionCallback(this);
this._functionCallback = null;
this[document.all ? "onreadystatechange" : "onload"] = null;
this.parentNode.removeChild(this);
};
__elementScript.src = __stringUrl;
(typeof __objectLoader == "string" ? document.getElementById(__objectLoader) : __objectLoader).appendChild(__elementScript);
};
this._arrayList = ["RMBGBP", "RMBHKD", "RMBUSD", "RMBCHF", "RMBSGD", "RMBSEK", "RMBDKK", "RMBNOK", "RMBJPY", "RMBCAD", "RMBAUD", "RMBEUR", "RMBMOP", "RMBPHP", "RMBTHB", "RMBNZD", "RMBKRW"];
this._process = function (__stringCode) {
var __stringHqCode = "hq_str_" + __stringCode;
if (__stringHqCode in window) {
var __arrayData = window[__stringHqCode].split(",");
return __arrayData;
}
};
this._fill = function () {
var __stringHtmlTemplate = this._stringHtmlTemplate;
var __arrayHtml = __stringHtmlTemplate.split("<!-- @LOOP@ -->");
var __stringHtmlHead = __arrayHtml[0];
var __stringHtmlBody = __arrayHtml[1];
var __stringHtmlFoot = __arrayHtml[2];
for (var i = 0; i < this._arrayList.length; i++) {
var __stringHtmlLoop = __stringHtmlBody;
var __arrayData = this._process(this._arrayList[i]);
var __arrayKeys = __stringHtmlLoop.match(/(<!--\s)?@[^@]*@(\s-->)?/gm);
if (__arrayKeys != null) {
for (var j = 0; j < __arrayKeys.length; j++) {
var __stringValue = __arrayData[__arrayKeys[j].replace(/(<!--\s)|(\s-->)/g, "").replace(/@/g, "")];
__stringValue = typeof __stringValue == "undefined" ? "--" : __stringValue;
__stringHtmlLoop = __stringHtmlLoop.replace(__arrayKeys[j], __stringValue);
}
}
__stringHtmlHead += __stringHtmlLoop.replace(/_style=/g, "style=");
}
this._elementTarget.innerHTML = __stringHtmlHead + __stringHtmlFoot;
};
this._load = function () {
this._loadScript("script_loader", "http://hq.sinajs.cn/rn=" + this._random() + "&list=" + this._arrayList.join(","), this._bind(this._fill))
};
this.boot = function (__stringTargetId) {
this._elementTarget = this._get(__stringTargetId);
this._stringHtmlTemplate = this._elementTarget.innerHTML;
this._load();
setInterval(this._bind(this._load), 5 * 60 * 1000);
};
}).boot("body_container");
</script>



<!-- END Nielsen//NetRatings SiteCensus V5.3 -->
</body>
</html>

  • 打赏
  • 举报
回复
最简单的方式就是IFRAME个外汇行情网站的图表页面。一些这类网站专门提供这种供引用的页面,去找一下就有了。
fengqipiaobo 2011-04-09
  • 打赏
  • 举报
回复
楼主指的可是左上角的外汇行情的图表!

建议,还是直接用第三方接口,估计要花点Money!

因为,就算你可以用ajax 实现这样的功能,但是,里面的实时数据 从何而来呢!?还是需要别人提供的哦!
hch126163 2011-04-09
  • 打赏
  • 举报
回复
也是iframe

<iframe scrolling="no" height="320" frameborder="0" width="220," id="frame" style="margin: 0pt; padding: 0pt;" src="http://trade.huidafx.com/for_price/chart_partners.html?style={"title":{"text":"\u6b27\u5143\/\u7f8e\u5143%205\u5206\u949f","period":"5","color":"0x004A7C","size":"12","font":"\u5b8b\u4f53"},"tooltip":{"backcolor":"0xFFFFFF","color":"0x004A7C","font":"\u5b8b\u4f53","size":"14","mod":"1","timemod":"m\/d%20h:i"},"background":{"color":"0xffffff"},"x_axis":{"count":"30","step":"60","color":"0x004A7C","size":"9","font":"Arial","timemod":"h:i"},"y_axis":{"count":"3","color_a":"0xf73b3b","color_b":"0x1b8a03"},"y_list":{"backcolor":"0xff0000","color":"0xffffff","size":"9","font":"Arial","timemod":"h:i"}}&curr=EURUSD&period=5&width=220&height=320&data_c=30"></iframe>
xing199007 2011-04-09
  • 打赏
  • 举报
回复
学习~帮顶
hch126163 2011-04-09
  • 打赏
  • 举报
回复
<iframe width="220" height="250" frameborder="0" scrolling="no" src="http://shell.cnfol.com/forex/Currency.php"></iframe>

是一个 iframe 直接放入一个div 就可以了
kingdom_0 2011-04-09
  • 打赏
  • 举报
回复
jquery。
xuxubaby 2011-04-09
  • 打赏
  • 举报
回复
[Quote=引用 9 楼 y_h_t 的回复:]
2. httprequest将指定页面加载到本地,做分析获取你 要的内容。
[/Quote]

写错了,是httpwebrequest
xuxubaby 2011-04-09
  • 打赏
  • 举报
回复
1. ajax 异步获取那个页面中包含你要的内容的dom.html

2. httprequest将指定页面加载到本地,做分析获取你 要的内容。
createdatabase 2011-04-08
  • 打赏
  • 举报
回复
protected void Page_Load(object sender, EventArgs e)
{
string url = "http://www.boc.cn/cn/common/whpj.html";
string encodeType = "gb2312";
string err = "";
string postData2 = "";

Response.Write(WebClinetPost(url, postData2, encodeType,out err));
}

static string WebClinetPost(string url, string postData, string encodeType, out string err)
{
string uriString = url;
byte[] byteArray;
byte[] responseArray;
Encoding encoding = Encoding.GetEncoding(encodeType);
try
{
WebClient myWebClient = new WebClient();
WebHeaderCollection myWebHeaderCollection;
myWebClient.Headers.Add("Content-Type", "application/x-www-form-urlencoded");
myWebHeaderCollection = myWebClient.Headers;

byteArray = encoding.GetBytes(postData);
responseArray = myWebClient.UploadData(uriString, "POST", byteArray);
err = string.Empty;
return encoding.GetString(responseArray);
}
catch (Exception ex)
{
err = ex.Message;
return err;
}
}
dayizhixiaotutu 2008-12-23
  • 打赏
  • 举报
回复
帮顶
veiny 2008-12-23
  • 打赏
  • 举报
回复
帮顶
RJCHEN1985 2008-12-22
  • 打赏
  • 举报
回复
用js写一个方法实现刷新那一部分数据的功能,function func(){//...}
然后在页面定时执行该方法setInterval("func()",5*60*1000);
Even713 2008-12-22
  • 打赏
  • 举报
回复
up
阿云ivan 2008-12-22
  • 打赏
  • 举报
回复
ajax
空心兜兜 2008-12-22
  • 打赏
  • 举报
回复
确实是需要实时交互
用户的选择是AJAX
而图表的自动更新是JS编写自动从服务器检测是否更新、取值再到更新
cjiamei0 2008-12-22
  • 打赏
  • 举报
回复
不是吧,100分都没有帅哥帮我吗。55555

87,901

社区成员

发帖
与我相关
我的任务
社区描述
Web 开发 JavaScript
社区管理员
  • JavaScript
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧