A網頁是欲載入的網頁
B網頁是我目前做的網頁
請問要如何將html檔透過<input type="file">選取檔案的方式
將一個A網頁(html)的內容載入B網頁內容呢
我原本用
<input id="file" type="file" name="file" onClick="myFunction()" />
<br />
<button onclick="loadAction()">載入</button>
<script>
var x
function myFunction()
{
x = document.getElementById("file");
}
function loadAction()
{
alert(x.value);
$('#page2').load(x.value,function(response) {$('#page2').text(response); });
$('#page').load(x.value);
}
</script>
jQuery的load後面如果打上路徑可以讀取檔案,
不過用input的方式,將選取的檔案以x表示
可以再alert看到x.value,也就是絕對位子的路徑
但是貼到load怎麼樣都讀不到,請問各位可以怎解決呢?
謝謝