[問題] 載入html檔到網頁內
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怎麼樣都讀不到,請問各位可以怎解決呢?
謝謝
--
※ 發信站: 批踢踢實業坊(ptt.cc), 來自: 163.17.133.110
※ 文章網址: http://www.ptt.cc/bbs/Web_Design/M.1401373419.A.1BA.html
※ 編輯: phenombox (163.17.133.110), 05/29/2014 22:25:50
→
05/29 22:25, , 1F
05/29 22:25, 1F
→
05/29 22:26, , 2F
05/29 22:26, 2F
→
05/29 22:26, , 3F
05/29 22:26, 3F
請問大大,我的網頁和被載入的網頁都是在同一台電腦,可是我有用xampp把我的網頁放在
htdoc內沒用到php,依然會有安全性的問題嗎?謝謝
※ 編輯: phenombox (163.17.133.110), 05/29/2014 22:27:32
※ 編輯: phenombox (163.17.133.110), 05/30/2014 10:21:17
推
05/30 11:14, , 4F
05/30 11:14, 4F
→
05/30 11:15, , 5F
05/30 11:15, 5F
了解了,謝謝您:)
※ 編輯: phenombox (163.17.133.110), 05/30/2014 11:51:37
推
05/31 02:22, , 6F
05/31 02:22, 6F
→
05/31 02:29, , 7F
05/31 02:29, 7F