1
我想设置一个iframe来“查看源代码:{URL}”的src使用如下:设置的iFrame来源为“查看源代码:{URL}”不工作
var url = document.getElementById('url');
var submit = document.getElementById('submit');
var target = document.getElementById('target');
submit.onclick = function(){
window.frames['target'].location.href = "view-source:" + url.value;
};
但它似乎设置了iframe相对于我的网站iframe的src。我想因为“view-source:x”只有在执行“location.href”时才起作用?
这是这种情况?
我使用JS的方式!
HTML:
<input type="text" id="url"></input>
<button id="submit">Submit</button>
<iframe id="target" src=""></iframe>
上传你的html代码(让生活更轻松) –