我在一个页面上有多个视频。当用户点击视频并完成播放时,我想从输入中获取值并显示该值。这就是我现在所拥有的:
HTML
document.getElementById('video')[0].addEventListener('ended', myHandler, false);
function myHandler(e) {
alert("Hello");
// What you want to do after the event
}
以上是PHP while循环
JS
nus = [0.001, 0.01, 0.1, 1]
gammas = [0.001, 0.01, 0.1, 1]
tuned_parameters = {'kernel' : ['rbf'], 'gamma' : gammas, 'nu': nus}
grid_search = GridSearchCV(svm.OneClassSVM(), tuned_parameters,
scoring="??????????????????????", n_jobs=4)
grid_search.fit(X_train)
答案 0 :(得分:0)
要从 javascript 中获取DOM元素的值:
document.getElementById('textbox_id').value
您可以按className
或tagName
(输入)或Name
每个视频必须addEventListener
所以..
var videos= document.getElementsByTagName("videos");
for (var i = 0; i < videos.length; i++) {
videos[i].addEventListener("ended", function(event) {
var target = event.target;
var parent = target.parentElement; // here you sepose to get the element above the video (the input)
});
}
以下是查找元素的解释:https://www.w3schools.com/js/js_htmldom_elements.asp