掲示板

Image Path in Java Script Decleration

11年前 に Kumar Bonagiri によって更新されました。

Image Path in Java Script Decleration

Junior Member 投稿: 35 参加年月日: 12/04/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
11年前 に Anil T によって更新されました。

RE: Image Path in Java Script Decleration

Expert 投稿: 313 参加年月日: 12/01/14 最新の投稿
Hi,

Can you try with <%= request.getContextPath()%>/images/abc.jpg like this in your code.
thumbnail
11年前 に Vishal Panchal によって更新されました。

RE: Image Path in Java Script Decleration

Expert 投稿: 289 参加年月日: 12/05/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.
11年前 に biswajit sarkar によって更新されました。

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"