【发布时间】:2014-06-15 22:20:34
【问题描述】:
我需要用那句话
每年的这个时候,你都会清理你的壁橱,清理架子上的灰尘,整理你的地板。一旦你处理了灰尘和污垢,那么一些数字清洁呢?浏览您的所有文件和计算机似乎是一项艰巨的任务,但我们找到了使该过程相当轻松的方法。
按下按钮后
拆分成一个数组
在每一步迭代该数组
随心所欲地构建 SPAN 元素以及属性
将 SPAN 元素添加到原始 DIV
向 SPAN 元素或 DIV 添加单击处理程序,这会导致 SPAN 上的样式在鼠标悬停时发生更改。
目前为止
function splitString(stringToSplit, separator) {
var arrayOfStrings = stringToSplit.split(separator);
print('The original string is: "' + stringToSplit + '"');
print('The separator is: "' + separator + '"');
print("The array has " + arrayOfStrings.length + " elements: ");
for (var i=0; i < arrayOfStrings.length; i++)
print(arrayOfStrings[i] + " / ");
}
var space = " ";
var comma = ",";
splitString(tempestString, space);
splitString(tempestString);
splitString(monthString, comma);
for (var i=0; i < myArray.length; i++)
{
}
var yourSpan = document.createElement('span');
yourSpan.innerHTML = "Hello";
var yourDiv = document.getElementById('divId');
yourDiv.appendChild(yourSpan);
yourSpan.onmouseover = function () {
alert("On MouseOver");
}
对于 html 我有
The DIV that will serve as your input (and output) is here, with
id="transcriptText":</p>
<div id="transcriptText"> It’s that time of year when you clean out your
closets, dust off shelves, and spruce up your floors. Once you’ve taken
care of the dust and dirt, what about some digital cleaning? Going
through all your files and computers may seem like a daunting task, but
we found ways to make the process fairly painless.</div>
<br>
<div id="divideTranscript" class="button"> Transform the
Transcript! </div>
关于如何移动一个的任何帮助?我已经卡了很长时间了
【问题讨论】:
-
你的代码出了什么问题?
标签: javascript html arrays button string-split