[英]HTML/CSS/JS: If I list several mp4 videos on a sidebar, how could I create a webpage where the video opens in the main part of the page when clicked?
[英]how to create a button in html/javascript/css that when clicked opens a sample web page within a webpage
我为一个类编写了一个简单的颜色选择器网站,用户在其中输入rgb,hsl或hex#,然后单击按钮时,生成6个色板中的颜色,其中6种是主色,互补色是深色和深色,以及相反的颜色然后必须有一个按钮,当单击该按钮时,会将具有6种颜色的示例网页加载到该示例网站中,以便用户可以“查看”他/她在网站上选择的颜色,例如交易的模板选择器类型。 我只想了解如何创建它,显然我现在正在编写示例网站,但是我不知道如何在我的javascript代码或html中进行设置。 如果您对处理方法有任何想法,请告诉我。 谢谢 :)
在页面内使用iframe标签,单击按钮即可更改iframe的src。
function changeurl(e) {
$('#iframe').attr('src', 'http://www.w3schools.com');
return false;
}
</script>
如果计划使用jQuery,则可以使用$.get()
加载另一个页面。
Javascript:
$(document).ready(function(){
$.get('ajax/test.html', function(data) {
// .result is the container selector for the loaded page
// data is the html of ajax/test.html
$('.result').html(data);
alert('Load was performed.');
});
});
标记:
<div class="result"></div>
这会将ajax/test.html
的内容放入带有class result
的div中。
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.