http://localhost/news-events/news.html?file=hosted_service.pdf
JS代码
parseURL : function() {
var _path = window.location.pathname;
console.log(_path);
var _locationSearch = location.search;
var _locationParse = _locationSearch.replace('?file=','');
console.log(_locationParse);
var filePath = "/pdffiles/"+_locationParse ; // /pdffiles/hosted_service.pdf
$('.divEmbed object').data(filePath); **How to set the data of object? this is wrong**
console.log(filePath);
}
的Html
<div class="divEmbed">
<object data="" type="application/pdf">
alt : It appears you don't have a PDF plugin for this browser.
Click <a href="">here</a> to Download the file.
</object>
</div>
将语法是什么,如果我想添加的对象的数据=文件路径
'$('。divEmbed object')。attr('data',filePath);'? – Mathletics 2013-03-06 02:09:53