CSDN博客

img qixiao

网页中插入real对象

发表于2004/12/30 21:16:00  1587人阅读

分类: JavaScript

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<TITLE>吉安视频新闻_real</TITLE>
<META http-equiv="Content-Type" Content="text/html; charset=gb2312">
<Style type="text/css">
BODY{ font-family: "宋体", "Arial", "Times New Roman"}
TD {
 FONT-SIZE: 12px; COLOR: #FFFFFF
}
A{
 COLOR: #CCCCCC; TEXT-DECORATION: none
}
</Style>

<SCRIPT language="JavaScript">
<!-- Hide
function killErrors() {
return true;
}
window.onerror = killErrors;
//容错
// -->
</SCRIPT>

<SCRIPT language="JavaScript">
<!--2003-10-20  18:00   With all best wishes for Hanjuan.
var absarcc="http://218.64.81.5/videonews/";
var srcc = window.location;
var today=new Date();
var hours=today.getHours();
if (hours>19){
//每天的新闻要在20:00之后才能录制完成
var day=today.getDate(),month=today.getMonth()+1,year=today.getFullYear();
}
else
{
yesterdayDate=today.getDate()-1;
today.setDate(yesterdayDate);
var day=today.getDate(),month=today.getMonth()+1,year=today.getFullYear();
//alert("is not ready.");
}
var scrdate=""+year+(month>9?month:"0"+month)+(day>9?day:"0"+day);
srcc = srcc.toString()
start = srcc.indexOf("?");
end = srcc.length;
if (start==-1) srcc = absarcc+scrdate+"-1.mpg";
else srcc = absarcc+srcc.substring(start+1,end);

var CanPlayy=false;
var RealMode=0;
var RealPlayer5=0;
var RealPlayer4=0;
var RealPlayerG2=0;
if (navigator.userAgent.indexOf("MSIE")< 0 )
{
 numPlugins = navigator.plugins.length;
 for (i = 0; i < numPlugins; i++)
 {
  plugin = navigator.plugins[i];
  if (plugin.name.substring(0,10)=="RealPlayer") RealMode=1;
 }
}
 document.write('<SCRIPT LANGUAGE=VBScript/>/n');
 document.write('on error resume next /n');
 document.write('RealPlayerG2 = (NOT IsNull(CreateObject("rmocx.RealPlayer G2 Control")))/n');
 document.write('RealPlayer5 = (NOT IsNull(CreateObject("RealPlayer.RealPlayer(tm) ActiveX Control (32-bit)")))/n');
 document.write('RealPlayer4 = (NOT IsNull(CreateObject("RealVideo.RealVideo(tm) ActiveX Control (32-bit)")))/n');
 document.write('</SCRIPT/> /n');
if ( RealPlayerG2 || RealPlayer5 || RealPlayer4 ){}
else if ( RealMode ){}
else
{
 alert("您的系统未安装RealPlay,系统将自动用MediaPlay播放");
 window.location.replace("../video/video_media.html");
 /*alert("请先下载并安装RealPalyer");
 window.location.replace("http://www.real.com"); // 转入安装页面指导用户进行安装
 window.resizeTo(700,500);*/
}
-->
</SCRIPT>

<SCRIPT language="JavaScript" fptype="dynamicanimation">
<!--
function dynAnimation() {}
function clickSwapImg() {}
//-->
</SCRIPT>

<SCRIPT language="javascript">
 function preload(imgname,imgsrc)
 {
  eval(imgname+'=new Image()')
  eval(imgname+'.src="'+imgsrc+'"')
 }
 for(i=1;i<=3;i++)
 {
  preload('st_search0'+i,'images/st_search0'+i+'.gif')
  preload('st_play0'+i,'images/play_b.gif')
  preload('st_stop0'+i,'images/stop_b.gif')
  preload('st_pause0'+i,'images/pause_b.gif')
  preload('st_sound0'+i,'images/st_sound0'+i+'.gif')
 }
 var movestep=10;movetime=5;movestop=true;movestart=false;curmenu=-1;leftshow=false;rightshow=false;bothstar=false;
 var moveobj;
 var moveon=false;movelen=80;timesnum=100;rmstart=false;rm_tollen=0;timelen=1000;volumlen=44;volon=false;
 document.onmouseup=Total_Up
 document.ondragstart=doDragStart
 function doDragStart() {event.returnValue=false}
 
 var Living=true
 var AutoPlay=true
 var IsVidio
 var Button_Num=0;
 var Real
 Real='document.RPOCX.'
 var CanPlay=true;
 var CanStop=false;
 var CanPause=false;
 var fullscreen=false;
 var Mute=false;
 var CanSetPos=false;
 var SetPosStart=false;
 var GetLenStart=false
 var CanSetVol=true;
 var SetVolStart=false
 var bigwin=false;
 var PlayState=0;
 var SVolume = 50; 

var playsrc
function playy(src){
playsrc=src
ClickStop()
ClickPlay()
}
function init()
{
 MM_Down(1,1,playimg,st_play02);
 ClickPlay();
 MM_Up(1,1,playimg,st_play01,st_play03); 
}
 
function DoPlay()
{eval(Real+'DoPlay()');}
function DoStop()
{eval(Real+'DoStop()');}
function DoPlayPause()
{eval(Real+'DoPlayPause()');}
 
function SetPosition(Pos)
{eval(Real+'SetPosition(Pos)');}
function SetVolume(Pos)
{eval(Real+'SetVolume(Pos)');}
 
function SetMute(Status)
{eval(Real+'SetMute(Status)');}
 
function GetLength()
{return eval(Real+'GetLength()');}
function GetPosition()
{return eval(Real+'GetPosition()');}
function GetPState()  //**
{return eval(Real+'GetPlayState()');}
 
function SetSource(srcname)
{eval(Real+'SetSource(srcname)')}
 
function SetWH(widthpx,heightpx)
{eval(Real+'width=widthpx');eval(Real+'height=heightpx')}
 
function SetFullScreen()
{
  eval(Real+'SetFullScreen()');
}
 
function M_Down(Num,Status,D_Img,S_Img)
 {
  if (Status&&event.button!=2)
  {
   Button_Num=Num;
   D_Img.src=S_Img.src;
  }
 }
function MM_Down(Num,Status,D_Img,S_Img)
 {
  if (Status)
  {
   Button_Num=Num;
   D_Img.src=S_Img.src;
  }
 }
function M_Up(Num,Status,D_Img,S1_Img,S2_Img)
 {
  if(event.button!=2)
  {
   if (Num==Button_Num)
   {
    if (Status)
     D_Img.src=S2_Img.src
   }
   else
    Total_Up();
   Button_Num=0;
  }
 }
function MM_Up(Num,Status,D_Img,S1_Img,S2_Img)
 {
   if (Num==Button_Num)
   {
    if (Status)
     D_Img.src=S2_Img.src
   }
   else
    Total_Up();
   Button_Num=0;
 }
 
function ClickPlay()
 {
  if (CanPlay)
  {
        document.RPOCX.setSource(playsrc);
   CanPlay=false;
   CanPause=true;
   pauseimg.src="images/pause.gif"
   PlayState=1;
   CanSetPos=true;
   getlen();
   if (!CanStop)
   {
    CanStop=true;
    stopimg.src="images/stop.gif";
   }
   DoPlay();
  }
 }
 function ClickPause()
 {
  if (CanPause)
  {
   CanPause=false;
   CanPlay=true;
   playimg.src="images/play.gif";
   PlayState=4
   CanSetPos=false;
   if(moveon) clearTimeout(mfollow)
   DoPlayPause();
  }
 }
 function ClickStop()
 {
  if (CanStop)
  {
   CanStop=false;
   CanPlay=true;
   playimg.src="images/play.gif";
   PlayState=0
   if (CanPause)
   {
    CanPause=false;
   }
   pauseimg.src="images/pause.gif";
   if(CanSetPos) {CanSetPos=false;stopimg.src=st_stop03.src}
   if(moveon) clearTimeout(mfollow)
   mblock.style.left=136
   DoStop();
  }
 }
 
function ClickSound()
{
  Mute=(!Mute);
  SetMute(Mute);
  if (Mute)
  {document.soundimg.src="images/sound_b.gif";}
  else
  {document.soundimg.src="images/sound.gif";}
}
 
function Total_Up()
 {
   switch (Button_Num)
   {
    case 1: playimg.src="images/play.gif";break;
    case 2: pauseimg.src="images/pause.gif";break;
    case 3: stopimg.src="images/stop.gif";break;
   }
   if(SetPosStart) setpos();
   if(SetVolStart) setvol();
 }
 
 function moves()
 {
  if(CanSetPos&&event.button!=2)
  {
   DoPlayPause()
   orix=event.x
   orileft=mblock.style.pixelLeft
   if(moveon) clearTimeout(mfollow)
   SetPosStart=true
  }
  else
  return false
 }
 
function movego()
 {
  if(SetPosStart)
  {
   newx=event.x
   disx=newx-orix
   newleft=orileft+disx
   if(newleft>136&&newleft<movelen+136) mblock.style.left=newleft
  }
 }
 
function setpos()
 {
  SetPosStart=false
  newleft=mblock.style.pixelLeft-136
  rcp=Math.floor((newleft/movelen)*rm_tollen)
  SetPosition(rcp)
  setTimeout('moveshow()',timelen)
  DoPlay()
 }
function getlen()
 {
  PlayState=GetPState();
  if(PlayState==2||PlayState==1||PlayState==0||PlayState==-1) {reget=setTimeout('getlen()',1000);GetLenStart=true}
  else
  {
   CanSetPos=true;
   rm_tollen=GetLength()
   if(GetLenStart) clearTimeout(reget)
   //timelen=Math.floor(rm_tollen/timesnum)
 //  alert("totaltime:"+rm_tollen+"   timelen:" + timelen);
   
   moveshow()
  }
 }

function GetFullScreen()
{
  return eval(Real+'GetFullScreen()');
}
 
function moveshow()
{
 rm_curpos=GetPosition()
 rm_tollen=GetLength()
 if(!GetFullScreen()&&!fullscreen)
 {
  resttime=rm_tollen-rm_curpos
  if(resttime<timelen)
  {
   mblock.style.left=movelen+136;
   setTimeout('MM_Down(3, CanStop, stopimg, st_stop02); ClickStop(); MM_Up(3, CanStop, stopimg, st_stop01, st_stop03)', resttime);
   moveon=false;
   ClickStop();
  }
  else if(rm_curpos<rm_tollen)
  {
   blockpos=Math.floor((movelen/rm_tollen)*rm_curpos);
   mblock.style.left=blockpos+136;
   moveon=true;
   mfollow=setTimeout('moveshow()',timelen);
   
  }

  fullscreen=false;
 }
}

function setvol(plusnum)
 {
  if(plusnum == 10)
  {
   if(SVolume != 100)
   {
    SVolume += plusnum;
    SetVolume(SVolume);
    
   }
  }
  if(plusnum == -10)
  {
   if(SVolume != 0)
   {
    SVolume += plusnum;
    SetVolume(SVolume);
    
   }
  }
 }

function PlaySel(selObj,restor){
    if (selObj.options[selObj.selectedIndex].value!="#"&&CanPlayy)
     {
  ClickStop()
  srcc=selObj.options[selObj.selectedIndex].value
  playy(srcc)
  playimg.src="images/play_b.gif";
  //window.location.href=selObj.options[selObj.selectedIndex].value,"";
  if (restor) selObj.selectedIndex=0;
  }

</SCRIPT>
</HEAD>

<BODY Text="#000000" bgColor="#FFFFFF" leftMargin="0" topMargin="0" onLoad="playy(srcc)" onUnload="DoStop();" onContextMenu="return(event.ctrlKey);" onSelectStart="return(false);">
<IMG id="mblock" src="images/course_button.gif" alt="定位(seek)" width="15" height="11" style="LEFT: 136px;TOP: 263px; POSITION: absolute;CURSOR: hand" onMouseDown="moves()" onMouseUp="Total_Up()" onMouseMove="movego()">
<div id="menu01" style="position:absolute; z-index:0; background-color: #D9E1F9;layer-background-color: #D9E1F9;visibility: hidden"></div>
<table width="335" border="0" cellpadding="0" cellspacing="0" bgcolor="#3A3A3A">
  <TR>
    <TD><table width="335" border="0" cellspacing="0" cellpadding="0">
        <tr>
          <td width="207"><img src="images/logo.gif" width="207" height="34"></td>
          <td align="center"><select name="select" style="background-color:#687178;color:#DDDDDD;height:19px" onChange="PlaySel(this,1);">
              <option value="#" selected>播放列表</option>
     <script language="JavaScript" type="text/javascript">
     <!--
     var itemstr;
     var filestr;
     for (i=0;i<7;i++)
     {
     today=new Date();
     beforDate=hours>19?today.getDate()-i:today.getDate()-i-1;
     today.setDate(beforDate);
     day=today.getDate(),month=today.getMonth()+1,year=today.getFullYear();
     itemstr=year+"年"+month+"月"+day+"日";
     scrdate=""+year+(month>9?month:"0"+month)+(day>9?day:"0"+day);
     filestr=absarcc+scrdate+"-1.mpg";
     document.write("<option value='"+filestr+"'>"+itemstr+"</option>");
     }
      CanPlayy=true;//播放列表更新完成之后激活其onChange事件
     -->
     </script>
            </select>
            </td>
        </tr>
      </table></TD>
  </TR>
  <TR>
    <TD height="221" align="center" bgcolor="#4E565C"><object id=RPOCX height=180 width=240
      classid=clsid:CFCDAA03-8BE4-11cf-B84B-0020AFBBCCFA bgcolor="#000000">
        <param name="CONTROLS" value="Imagewindow">
        <param name="AUTOSTART" value="1">
        <param name="NOLABELS" value="0">
        <param name="CONSOLE" value="clip1">
        <param name="_ExtentX" value="9525">
        <param name="_ExtentY" value="6350">
        <param name="SHUFFLE" value="0">
        <param name="PREFETCH" value="0">
        <param name="LOOP" value="1">
        <param name="NUMLOOP" value="0">
        <param name="CENTER" value="0">
        <param name="MAINTAINASPECT" value="0">
        <param name="BACKGROUNDCOLOR" value="#000000">
      </object></TD>
  </TR>
  <TR>
    <TD height="1" bgcolor="#142E44"></TD>
  </TR>
  <TR>
    <TD height="27" align="center"><TABLE cellSpacing="0" cellPadding="0" width="335" border="0">
        <TR>
          <TD width="7">&nbsp;</TD>
          <TD width="37"><IMG src="images/play_b.gif" alt="开始播放(Play)" name="playimg" width="37"height="11" style="CURSOR: hand" onClick="ClickPlay()" onMouseDown="M_Down(1,CanPlay,playimg,st_play03)" onMouseUp="M_Up(1,CanPlay,playimg,st_play01,st_play03)"></TD>
          <TD width="6">&nbsp;</TD>
          <TD width="37"><IMG src="images/stop.gif" alt="停止播放(Stop)" name="stopimg" width="37" height="11" style="CURSOR: hand" onClick="ClickStop()" onMouseDown="M_Down(3,CanStop,stopimg,st_stop03)" onMouseUp="M_Up(3,CanStop,stopimg,st_stop01,st_stop03)"></TD>
          <TD width="6">&nbsp;</TD>
          <TD width=37><IMG src="images/pause.gif" alt="暂停(Pause)" name="pauseimg" width="37" height="11" style="CURSOR: hand"  onClick="ClickPause()" onMouseDown="M_Down(2,CanPause,pauseimg,st_pause03)" onMouseUp="M_Up(2,CanPause,pauseimg,st_pause01,st_pause03)"></TD>
          <TD width="6">&nbsp;</TD>
          <TD width="93"><IMG src="images/course.gif" width="93" height="11"></TD>
          <TD width="6">&nbsp;</TD>
          <TD width="11"><IMG src="images/sound.gif" alt="静音(Mute)"  name="soundimg" width="11" height="11" style="CURSOR: hand" onClick="ClickSound()"></TD>
          <TD width="6">&nbsp;</TD>
          <TD width="15"><img src="images/volume2.gif" alt="减小音量(Volume)" width="15" height="11" style="CURSOR: hand" onClick="javascript:setvol(-10)"></TD>
          <TD width="12"><img src="images/volume2_c.gif" width="12" height="11"></TD>
          <TD width="25"><img src="images/volume2_b.gif" alt="增大音量(Volume)" width="15" height="11" style="CURSOR: hand" onClick="javascript:setvol(10)"></TD>
          <TD width="6">&nbsp;</TD>
          <TD><IMG src="images/full.gif" alt="全屏(Full)" width="11" height="11" style="CURSOR: hand" onClick="SetFullScreen()"></TD>
          <TD width="7">&nbsp;</TD>
        </TR>
      </TABLE></TD>
  </TR>
  <TR>
    <TD height="1" bgcolor="#666666"></TD>
  </TR>
  <TR>
    <TD height="48"><TABLE cellSpacing="0" cellPadding="0" width="335" border=0>
        <TR>
          <TD width="7">&nbsp;</TD>
          <TD width="75"> <TABLE cellSpacing="0" cellPadding="0" width="75" border="0'">
              <TR>
                <TD bgColor="#5E686F"><IMG src="images/realplayer.gif" height="18" width="73"></TD>
              </TR>
              <TR>
                <TD height="2"></TD>
              </TR>
              <TR>
                <TD><A href="video_media.html"><IMG src="images/mediaplayer_b.gif" height="18" width="73"  border="0"></A></TD>
              </TR>
            </TABLE></TD>
          <TD bgColor="#5E686F"> <TABLE cellSpacing="0" cellPadding="0" width="100%" border="0">
              <TR>
                <TD width="50" align="center"><IMG src="images/reallogo.gif" height="28" width="33"></TD>
                <TD><A href="http://www.real.com/">real player 插件下载</A></TD>
              </TR>
            </TABLE></TD>
          <TD width="7">&nbsp;</TD>
        </TR>
      </TABLE></TD>
  </TR>
</table>
</BODY>
</HTML>

0 0

相关博文

我的热门文章

img
取 消
img