Javascript Windows MediaPlayer完整示范版
一、主页面(采用jsp实现)
<%@ page language="java" contentType="text/html; charset=gb2312"
pageEncoding="gb2312"%>
<%@page import="org.accp.jwebplayer.biz.MusicBiz"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>Insert title here</title>
<mce:script type="text/javascript"><!--
//保存当前播放曲目在列表中的索引
var index = 0;
//var timer = null;
function $(oid){
return document.getElementById(oid);
}
//到指定位置播放
function playposition() {
$('wmp').controls.currentPosition = parseFloat($("position").value);
$("position").value = "1.0";
}
function showMusicInfo(){
$('spnCurrentMediaName').innerText = $('wmp').currentMedia.name;
$('spnCurrentMediaDuration').innerText = $('wmp').currentMedia.durationString;
$('spnCurrentMediaWidth').innerText = $('wmp').currentMedia.imageSourceWidth;
$('spnCurrentMediaHeight').innerText = $('wmp').currentMedia.imageSourceHeight;
$('spnCurrentMediaMarkerCount').innerText=$('wmp').currentMedia.markerCount;
$('spnCurrentSourceURL').innerText = $('wmp').currentMedia.sourceURL;
}
//下一首
function next(){
if (index<$('playList').options.length-1){
index++;
$('wmp').URL=$('playList').options[index].value;
$('playList').selectedIndex=index;
showMusicInfo();
}
}
//上一首
function pre(){
if (index>0){
index--;
$('wmp').URL=$('playList').options[index].value;
$('playList').selectedIndex=index;
showMusicInfo();
}
}
//检查播放器的状态
//function checkState(){
// if ($('wmp').playState==1){
// n
相关文档:
confirm函数
confirm函数用于提供确认功能,它首先显示给定的message参数所包含的信息,并提供两个可选择的回答“ok”和“cancel”,然后等待用户选择其中的一个。如果用户选择“ok”则返回true;否则,如若选择“cancel”则返回false。该函数的语法格式如下:
window.con ......
JavaScript不区分单个字符和字符串,任何字符或字符串可以用双引号或单引号引起来。如果字符串本身含有双引号,则应使用单引号将字符串括起来;如果字符串本身含有单引号,则应使用双引号将字符串引起来,两者可以嵌套使用。 ......
今天在学习Bom时遇到了一个错误:
Static overflow at 7
错误原因:自定义了一个 scrollTo(),与系统window.scrollTo()冲突,以致引起死循环,此错误在弹出错误框,而在FF下没有反应,但function也不执行。另外<img src="" onerror=""/>也可能出现这种情况。详细请参考:http://www.cnblogs.com/S.Sams/archive/200 ......
有时候进行ajax交互的时候,返回的数据可以自己添加分隔符,比如^^^,然后对这些分隔符进行解析,分解为一个数组。
function fill(v) {
if (v == undefined)return false;
var result = v.split("^^^");
$("#cnPatent").val(result[0]);
$("#cnPText").val(result[1]); ......