我的网站上有多个HTML5视频和声音元素。我已经为媒体使用自定义控件,所以我实现了一些javascript / jQuery。
使用单一媒体,控制部分工作正常!如果我在我的网站上显示多个单一媒体,则控件不再有效。
我认为有些javascript是重叠的。这是我的代码:
USE [Test]
GO
IF EXISTS(SELECT * FROM sys.objects WHERE Name = 'Person_Permissions' AND Type = 'U')
DROP TABLE [dbo].[Person_Permissions]
GO
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
SET ANSI_PADDING ON
GO
--Creating a table to test this out
CREATE TABLE [dbo].[Person_Permissions](
[ID] [int] IDENTITY(1,1) NOT NULL,
[FirstName] [varchar](50) NULL,
[LastName] [varchar](50) NULL,
[UserName] [varchar](50) NULL,
[Department] [varchar](50) NULL
) ON [PRIMARY]
GO
SET ANSI_PADDING OFF
GO
--Setting some null data
INSERT INTO [dbo].[Person_Permissions](FirstName,LastName,UserName,Department)
VALUES('Joe','Smith','JSmith',null)
GO
DECLARE @TempColumns TABLE
(
ID int IDENTITY(1,1),
ColumnName varchar(100)
)
INSERT INTO @TempColumns
SELECT COLUMN_NAME FROM INFORMATION_SCHEMA.COLUMNS
WHERE TABLE_NAME = 'Person_Permissions'
DECLARE @Idx int = (select count(*) from @TempColumns)
DECLARE @ColumnNameSelect varchar(max) = ''
WHILE @Idx > 0
BEGIN
DECLARE @ColumnName varchar(100) = (select ColumnName from @TempColumns where ID = @Idx)
DECLARE @ValueLength int
DECLARE @ParmDefinition nvarchar(500) = N'@ValueLengthOUT int OUTPUT';
--using a sub query to check length of all values if null make it zero
DECLARE @Sql nvarchar(max) = ('SELECT @ValueLengthOUT=ISNULL(SUM(A.ValueLength),0) FROM (SELECT LEN([' + @ColumnName + ']) ValueLength FROM [dbo].[Person_Permissions]) AS A' )
exec sp_executesql @Sql, @ParmDefinition, @ValueLengthOUT=@ValueLength OUTPUT;
--if there is a value for the column use that column in our select
IF (@ValueLength > 0)
BEGIN
SET @ColumnNameSelect = @ColumnNameSelect + @ColumnName + ','
END
SET @Idx = @Idx - 1
END
DECLARE @cmd varchar(max)= 'SELECT ' + (SELECT LEFT(@ColumnNameSelect, LEN(@ColumnNameSelect) -1)) + ' FROM [Person_Permissions]'
EXEC (@cmd)
有没有办法重建脚本以便我可以使用多个媒体元素?