简体   繁体   English

在javascript文件中选取路径

[英]picking up a path in a javascript file

I need some help with my js file. 我的js文件需要一些帮助。 I an using a bit of javascript to show some xml on a page and I need to reference the right xml file according to the page that it is on. 我使用了一些JavaScript来在页面上显示一些xml,我需要根据页面所在的页面来引用正确的xml文件。 eg 例如

<script>
xml=loadXMLDoc("product.xml");
</script>

I have the all the xml files named as different products and have printed out the reference to the xml on the page that it should be on 我将所有的xml文件都命名为不同的产品,并在该页面上打印了对xml的引用

<div id="product">/xmlfolder/item001.xml</div>

What I need to do is somehow reference the path on the page to the javascript. 我需要做的是以某种方式引用页面上的javascript路径。 Is this possible? 这可能吗?

Thanks 谢谢

你的意思是

xml=loadXMLDoc(document.getElementById('prodct').innerHTML);

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM