استخراج یک قسمت از یک صفحه

xerror

Member
سلام
می‌خواهم قسمتی از یک صفحه که یک تیکه برنامه و کد هست رو استخراج کنم و برای خودم از آن استفاده کنم تا یه جاهایی هم پیش رفتم ولی متاسفاه کار نکرد یعنی دیگه بیشتر از اون حد نمی‌دونستم. در سایت http://chartseeker.com در قسمت گوشه بالای صفحه سمت راست یک قسمتی هست (تصویر) که اون قسمت رو می‌خواهم برای خودم داشته باشم و در صفحات دیگر استفاده کنم.

تا اینجای کار رو هم رفتم ولی دیگه مخم نکشیده:
کد:
<html xmlns="http://www.w3.org/1999/xhtml">

<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>MetalsBIDASK</title>
</head>

<body>
<script src="http://chartseeker.com/ajax-quotes/js/prototype.js" type="text/javascript"></script>

<script>

function toggle_loading(v)
{
  if (v)
  {
   //$('loading_status').style.display = 'block';
   	var f = $$('.loading');
	for(var i=0; i<f.length; i++){
		f[i].style.display = 'block';;
	}
  } else {
   //$('loading_status').style.display = 'none';
   //$$('.loading').style.display = 'none';
   	var f = $$('.loading');
	for(var i=0; i<f.length; i++){
		f[i].style.display = 'none';;
	}
  }
}
function get_status()
{
               toggle_loading(1);

		var url = 'http://chartseeker.com/quotes/metals.txt';
		var pars = 'r='+ Math.random();

		var myAjax = new Ajax.Request(
			url,
			{
				method: 'GET',
				parameters: pars,
				onComplete: setDataJSON
			});

   setTimeout('get_status()',6000);
}

function setDataJSON(req)
{
    //$('loading_status').style.display = 'none';
    setTimeout('toggle_loading(0)',500);

	var data = eval('(' + req.responseText + ')');
        var data_str = '';

        //alert(req.responseText);
       



        // $('test').innerHTML =  data[0][0] ;
          //alert(data[0].bid);
         //---------------------
         //---------------------
         $('gold_price').innerHTML = data[0].ask;
         $('gold_price_bid').innerHTML = data[0].bid;
         $('silver_price').innerHTML = data[1].ask;
         $('silver_price_bid').innerHTML = data[1].bid;
         $('platinum_price').innerHTML = data[2].ask;
         $('platinum_price_bid').innerHTML = data[2].bid;




   //get status every X sec

  return true;
}
  window.onload=function(){get_status();}


</script> 
<style>

 .metal_chart
 {
  color:#000;
  font-family: arial;
  font-size:10pt;
  width:220px;
  border-top:#999 1px dashed;
  border-left:#999 1px dashed;
  border-right:#999 1px dashed;
  border-bottom:#999 1px solid;
 }
 .metal_head
 {
  text-align:left;
  height:17px;
  clear:both;
  font-size:8pt;
  font-weight:bold;
  background-color:#d5d5d5;
  border-bottom:#999 1px solid;
 }
 .metal_head div
 {
  text-align:left;
  float:left;

 }
 .metal_row
 {
  height:16px;
  margin-left:20px;
  font-size:10pt;
  clear:both;
  border-bottom:#999 1px solid;
 }
 .metal_row div
 {
  float:left;
 }
 .metal_label
 {
  font-size:8pt;
  text-align:left;
  width:70px;
 }
 .metal_price
 {
  font-size:8pt;
  width:45px;
  text-align:right;
  margin-right:10px;
  font-weight:normal;
 }
</style>
<div class="metal_chart">
 <div class="metal_head">
   <div style="width:18px;height:18px;padding-top:1px;"><div id="loading_status" class="loading"><img src="http://chartseeker.com/ajax-quotes/progress.gif" alt="LOADING DATA" title="LOADING DATA" /></div></div>
   <div style="width:75px">Metals</div>
   <div style="width:58px">BID</div>
   <div>ASK</div>

 </div>
 <div class="metal_row">
   <div class="metal_label">GOLD</div>
   <div id="gold_price_bid" class="metal_price"></div>
   <div id="gold_price" class="metal_price"></div>
 </div>
 <div class="metal_row">
   <div class="metal_label">SILVER</div>

   <div id="silver_price_bid" class="metal_price"></div>
   <div id="silver_price" class="metal_price"></div>
 </div>
 <div class="metal_row" style="border-bottom:#fff 0px solid">
   <div class="metal_label">PLATINUM</div>
   <div id="platinum_price_bid" class="metal_price"></div>
   <div id="platinum_price" class="metal_price"></div>
 </div>

 
</div>
</body>

</html>
 

mazoolagh

Active Member
اینکار رو سمت سرور انجام بدین - البته ممکنه سایت تمهیداتی برای جلوگیری از کار شما بکار برده باشه!!
 

جدیدترین ارسال ها

بالا