javascript 跨域名 异常:
var select_val;
var str3 = " <img src='images/right03.gif' width='5' height='22' hspace='8' align='absbottom' />";
var str = "<tr class='nav2_title'> <td width='70%' height='35' align='center' >新闻标题 </td> <td width='30%' align='center'>时 间 </td> </tr>";
var str1 = "<tr class='elem'> <td height='24' align='center' ><a href='#' class='right05'>标题内容</a></td> <td align='center'>2011/01/01</td> </tr>";
var cgi_str_bz = "http://url.cgi";
var cgi_str_hy = "http://url.cgi";
var cgi_str_xw = "http://url.cgi";
$(document).ready(function()
{
var str1 = cgi_str_xw+"?keyword=天翼";
hotsearch(str1);
Type(0);
});
function basCTDao_abuss_callback(json)
{
contrldiv(json);
ReturnHandle(json);
}
function basCTDao_pbuss_callback(json)
{
contrldiv1(json);
ReturnHandle1(json);
}
function basCTDao_newslists_callback(json)
{
//alert(json.bas_pbuss.length);
draw_div1(json);
}
function deal(json)
{
var column = TimeLine2.getZ_data();
// JavaScript准备数据
var dp = [];
var i = 0;
for(i = 0; i < json.bas_pbuss.length; i++) {
dp.push( {z_name: json.bas_pbuss[i].buss_date,
z_value01: json.bas_pbuss[i].buss_count,
z_value02: json.bas_pbuss[i].buss_score} );
}
column.setSource(dp);
}
function deal1(json)
{
//alert(json.bas_pbuss.length);
var column = TimeLine3.getZ_data();
// JavaScript准备数据
var dp = [];
var i = 0;
for(i = 0; i < json.bas_pbuss.length; i++) {
dp.push( {z_name: json.bas_pbuss[i].buss_keyword,
z_value01: json.bas_pbuss[i].buss_count,
z_value02: json.bas_pbuss[i].buss_score} );
}
column.setSource(dp);
}
function contrldiv(json)
{
var i = 1;
draw_div(json.bas_pbuss.length,1);
for(i = 0; i < json.bas_pbuss.length; i++)
{
$('#divcontorl .elem:eq('+ i +') td:eq(0)').html(json.bas_pbuss[i].buss_date);
$('#divcontorl .elem:eq('+ i +') td:eq(1)').html(json.bas_pbuss[i].buss_count);
}
}
function contrldiv1(json)
{
var i = 1;
draw_div(json.bas_pbuss.length,0);
for(i = 0; i < json.bas_pbuss.length; i++)
{
$('#divcontorl .elem:eq('+ i +') td:eq(0)').html(json.bas_pbuss[i].buss_keyword);
$('#divcontorl .elem:eq('+ i +') td:eq(1)').html(json.bas_pbuss[i].buss_count);
}
}
function draw_div(json, index)
{
$("#divcontorl").html(str);
var name, name1;
if(index == 0)
{
name = "业务名称";
name1 = "电信比重";
}
else if(index == 1)
{
name = "时间";
name1 = "关注度";
}
$('#divcontorl .nav2_title td:eq(0)').html(name);
$('#divcontorl .nav2_title td:eq(1)').html(name1);
for(i = 1 ; i < json; i++)
{
$("#divcontorl").append(str1);
}
for(i = 0 ; i < json; i++)
{
if( (i % 2) == 0)
$('#divcontorl .elem:eq('+ i +')').addClass("nav2_text2");
else
$('#divcontorl .elem:eq('+ i +')').addClass("nav2_text3");
}
}
function draw_div1(json)
{
$("#divcontorl1").html(str);
var max = 100;
if( max > json.bas_pbuss.length)
max = json.bas_pbuss.length;
for(i = 1 ; i < max; i++)
{
$("#divcontorl1").append(str1);
}
for(i = 0 ; i < max; i++)
{
if( (i % 2) == 0)
$('#divcontorl1 .elem:eq('+ i +')').addClass("nav2_text2");
else
$('#divcontorl1 .elem:eq('+ i +')').addClass("nav2_text3");
}
for(i = 0; i < max; i++)
{
$('#divcontorl1 .elem:eq('+ i +') td:eq(0) a').attr("href",json.bas_pbuss[i].buss_url);
}
for(i = 0; i < max; i++)
{
$('#divcontorl1 .elem:eq('+ i +') td:eq(0) a').html(json.bas_pbuss[i].buss_title);
$('#divcontorl1 .elem:eq('+ i +') td:eq(1)').html(json.bas_pbuss[i].buss_date);
}
}
function ReturnHandle(json) {
try {
deal(json);
TimeLine2.getLineChart().addEventListener("itemClick", flash_sec);
} catch(e) {
setTimeout(function(){ ReturnHandle(json) },100);
}
}
function ReturnHandle1(json) {
try {
deal1(json);
//var column = TimeLine2.getZ_data();
TimeLine3.getLineChart().addEventListener("itemClick", flash_first);
} catch(e) {
setTimeout(function(){ ReturnHandle1(json) },100);
}
}
function flash_first(argChartItemEvent)
{
var str1 = cgi_str_xw+"?keyword="+argChartItemEvent.getHitData().getItem().z_name;
hotsearch(str1);
}
function flash_sec(argChartItemEvent)
{
if(select_val == undefined)
var str1 = cgi_str_xw+"?date="+argChartItemEvent.getHitData().getItem().z_name;
else
var str1 = cgi_str_xw+"?date="+argChartItemEvent.getHitData().getItem().z_name+"&keyword="+select_val;
hotsearch(str1);
}
function selectvulue(index)
{
var str;
/*
if(index != 0)
{
str = $('.leftbg02:eq('+ index +')').html();
str = str.trim();
}
*/
if(index != 0)
str = getvalue(index);
if(index == 0)
{
str = cgi_str_bz;
}
else
{
str = cgi_str_hy+"?key="+str;
}
return str;
}
function getvalue(index)
{
var str;
str = $('.leftbg02:eq('+ index +')').html();
str = str.trim();
select_val = str;
return str;
}
function Type(index)
{
//select_val = index;
con_div(index);
con_color(index);
var str = selectvulue(index);
dealpage(index, str);
if(index != 0)
hotsearch(cgi_str_xw+"?keyword="+getvalue(index));
hotsearch(str);
}
function dealpage(index, str)
{
}
function con_div(index)
{
if(index == 0)
{
$(".flash").hide();
$(".flash1").show();
}
else
{
$(".flash").show();
$(".flash1").hide();
}
}
function con_color(index)
{
$("[name='type']").each(function(i)
{
$(this).attr("style","color:#687279");
})
$("[name='type']").each(function(i)
{
if(index==i)
{
$(this).attr("style","color:#8bc650");
type = $(this).text();
}
})
}
function hotsearch(index)
{
if (window.XMLHttpRequest)
{// code for IE7+, Firefox, Chrome, Opera, Safari
xmlhttp=new XMLHttpRequest();
//sortname = encodeURI(sortname);
}
else
{// code for IE6, IE5
xmlhttp=new ActiveXObject("Microsoft.XMLHTTP");
//sortname = encodeURI(sortname);
}
//q = encodeURI(type);
gScriptObj = document.createElement("script");
gScriptObj.setAttribute("type", "text/javascript");
gScriptObj.setAttribute("charset", "utf-8");
//if(index ==1)
//{
gScriptObj.setAttribute("src", index);
headObj = document.getElementsByTagName("head").item(0);
headObj.appendChild(gScriptObj);
}
function show()
{
if($("#checkbox1").attr("checked") == true)
TimeLine2.set_visible01(true);
else
TimeLine2.set_visible01(false);
if($("#checkbox2").attr("checked") == true)
TimeLine2.set_visible02(true);
else
TimeLine2.set_visible02(false);
}