留言板

Image Path in Java Script Decleration

Kumar Bonagiri,修改在11 年前。

Image Path in Java Script Decleration

Junior Member 帖子: 35 加入日期: 12-4-23 最近的帖子
Hi All,

please once go through the code

<script type="text/javascript">
var mqAry1=['../images/apartments1.png','../images/factory.png','../images/apartments1.png','../images/factory.png','../images/img4.gif','images/img5.gif','../images/img6.gif','../images/img7.gif','../images/img8.gif','../images/img9.gif','../images/img10.gif','../images/img11.gif','../images/img12.gif','../images/img13.gif','../images/img14.gif'];

function start() {
   new mq('m1',mqAry1,60);
   mqRotate(mqr); // must come last
}
</code></pre><br /><br />I have given image path as shown above and other different  ways.<br />but it is not working.<br />what is the correct way of Decleation of image in javascript  ? can any one tell me plzz .....!<br />am using liferay 6.1.<br /><br />please help me in this issue<br /><br />Reagrds,<br />ashwin Kumar.</script>
thumbnail
Anil T,修改在11 年前。

RE: Image Path in Java Script Decleration

Expert 帖子: 313 加入日期: 12-1-14 最近的帖子
Hi,

Can you try with <%= request.getContextPath()%>/images/abc.jpg like this in your code.
thumbnail
Vishal Panchal,修改在11 年前。

RE: Image Path in Java Script Decleration

Expert 帖子: 289 加入日期: 12-5-20 最近的帖子
Hi , Kumar Bonagiri .

I think Anil is right but if stil it doesn't work than you may try following..
"${pageContext.request.contextPath}/images/apartments1.png"

see the basic thing is that either "<%= request.getContextPath()%>" or "${pageContext.request.contextPath}" will return the path upto your docroot folder so you may complete your path like "/images/apartments1.png" after above both.


Thanks & Regards,
Vishal R. Panchal.
biswajit sarkar,修改在11 年前。

RE: Image Path in Java Script Decleration (答复)

Regular Member 帖子: 166 加入日期: 11-10-17 最近的帖子
you add "../images/apartments1.png" ,its not write javascrpit in liferay.

You should add images path like this "$images_folder/your folder name/apartments1.png"