小编Nog*_*oga的帖子

在youtube视频开始之前显示自定义图片

我正在尝试在"播放器"div中显示图像,然后在访问者单击按钮后,将其替换为视频(将div替换为iFrame).这是我的代码:

<!DOCTYPE html> 
<head>
<style type="text/css">
html {
text-align: center;
}

#player {
display: inline-block;
width: 640px;
height: 360px;
background: url(http://placehold.it/640x360) no-repeat;
}
</style>
</head>
<html>
  <body>
    <!-- 1. The <iframe> (and video player) will replace this <div> tag. -->
    <div id="player"></div>
    <p><button onclick="playMe()">Play</button></p>

    <script>
    function playMe() {
      // 2. This code loads the IFrame Player API code asynchronously.
      var tag = document.createElement('script');
      tag.src = "https://www.youtube.com/iframe_api";
      var firstScriptTag = document.getElementsByTagName('script')[0];
      firstScriptTag.parentNode.insertBefore(tag, firstScriptTag);

      // 3. This function creates an <iframe> (and …
Run Code Online (Sandbox Code Playgroud)

html javascript youtube-api youtube-javascript-api

6
推荐指数
1
解决办法
6894
查看次数

选择具有最高值/秒和第二高值/ s的表格单元格

我有下表,需要找到

  • 一个或多个td,其中"sum"类具有最高值(数字)
  • 一个或多个td,类"sum",第二个最高值(数字)
  • 将类"text-bold"添加到匹配的tds中

JSFiddle
代码

<!DOCTYPE html>
<html>
<head>
<style type="text/css">
.text-bold { font-weight: 700; }
table {
    margin: 16px 0;
    color:#333;
    border-width: 1px;
    border-color: #666;
    border-collapse: collapse;
}
table th {
    border-width: 1px;
    padding: 4px;
    border-style: solid;
    border-color: #666;
    background-color: #FBDD9B;
}
table td {
    border-width: 1px;
    padding: 4px;
    border-style: solid;
    border-color: #666;
    background-color: #fff;
}
</style>
</head>
<body>
    <table id="table-results">
        <tr>
            <th>Question</th>
            <th>inovation</th>
            <th>all-round</th>
            <th>coordination</th>
            <th>keeper</th>
            <th>analytic</th>
        </tr>
        <tr> …
Run Code Online (Sandbox Code Playgroud)

html javascript jquery

6
推荐指数
1
解决办法
1316
查看次数

将数组对象连接到字符串中

我有这样的数组

var Data = [{
"words": [
    "dolor",
    "sit",
    "amet",
    "consectetur"
],
    "description": "Lorem Ipsum."
}, {
"words": [
    "adipisicing",
    "elit",
    "sed",
    "do"
],
    "description": "Lorem Ipsum."
}];
Run Code Online (Sandbox Code Playgroud)

如何将所有单词连接成一个字符串,用单个管道符号"|"分隔 ?期望的输出应如下所示:( dolor | sit | amet | consectetur | adipisicing | elit | sed | do)

javascript arrays

1
推荐指数
1
解决办法
91
查看次数