我正在寻找一种使用 jQuery 将外部页面加载到 DIV onClick 的轻量级方法。
例如:
<a href="#" onclick="jQuery Load Function with unique ID 1">Load Page 1</a>
<a href="#" onclick="jQuery Load Function with unique ID 2">Load Page 2</a>
<a href="#" onclick="jQuery Load Function with unique ID 3">Load Page 3</a>
<a href="#" onclick="jQuery Load Function with unique ID 4">Load Page 4</a>
<div id="LoadMe">Where external page will load into</div>
任何帮助将不胜感激,
谢谢!
最佳答案
<a href="#" onclick="load(1);return false;">Load Page 1</a>
<a href="#" onclick="load(2);return false;">Load Page 2</a>
<a href="#" onclick="load(3);return false;">Load Page 3</a>
<a href="#" onclick="load(4);return false;">Load Page 4</a>
<div id="LoadMe">Where external page will load into</div>
<script>
function load(num){
$("#LoadMe").load('page'+num+'.php');
}
</script>
关于jquery - 使用 jQuery 加载到 Div 中,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/6949638/