English 中文(简体)
参考系系系系系母系目前的图像
原标题:refer to image in directory which is parent to current path
  • 时间:2012-05-04 18:35:51
  •  标签:
  • php
  • jquery

i have image in imagesa.jpg now my script is in jsa.js images and js dir are under document root www dir

a) 说明:

 var provider_img = $(this).attr( src );  \value of provider_img = imagesa.jpg
  title:  <img src=..provider_img /> ,

但图象没有在标题箱中显示。 请帮助我

最佳回答

道路应当:

images/a.jpg

不适用

imagesa.jpg
问题回答

引文如下:

title:  <img src=../  + provider_img +  /> ,

provider_img is a var, and in entitled You should ensure it out of quotes if les var to取而代之。

你们说的是:

Document root
 --> /js/
 --> /images/

如果是,不是试图走相对的道路,而是走一条绝对的道路,并提及<代码>/images/a.jpg的形象。

如果没有,以及你再次试图做其他事情的话,你可能需要做更多的澄清。

图表正确,所有尿素都使用UNIX途径分离器。 由于你重新使用斜线一米,假设你重新使用窗户机器。 如果你不屈服于 escaping腰的习惯,那么窗户是一条窗子,将来会引向你们:

..
ewDir === ..[new line]ewDir
..\newDir === ..
ewDir as you want it expected

您也不妨将可变值压缩为一种扼杀,而是将变数名称作为扼制:<img src=”/./+imgVar+“/>

<><>Edit>>

布赖恩·瓦沙是正确的,如果你想要的是正确的图像途径,那么你的道路应该从与 j路一样的立足点开始。 如果您的打字标有像/js/script这样的斜体,那么图像标签应当有相应的路径:/images/picture.jpg。 你的笔记要看档案,因此,路基应该是文件根基,而不是文字所在地。 (更多布赖恩,向他提供信贷)





相关问题
Brute-force/DoS prevention in PHP [closed]

I am trying to write a script to prevent brute-force login attempts in a website I m building. The logic goes something like this: User sends login information. Check if username and password is ...

please can anyone check this while loop and if condition

<?php $con=mysql_connect("localhost","mts","mts"); if(!con) { die( unable to connect . mysql_error()); } mysql_select_db("mts",$con); /* date_default_timezone_set ("Asia/Calcutta"); $date = ...

定值美元

如何确认来自正确来源的数字。

Generating a drop down list of timezones with PHP

Most sites need some way to show the dates on the site in the users preferred timezone. Below are two lists that I found and then one method using the built in PHP DateTime class in PHP 5. I need ...

Text as watermarking in PHP

I want to create text as a watermark for an image. the water mark should have the following properties front: Impact color: white opacity: 31% Font style: regular, bold Bevel and Emboss size: 30 ...

How does php cast boolean variables?

How does php cast boolean variables? I was trying to save a boolean value to an array: $result["Users"]["is_login"] = true; but when I use debug the is_login value is blank. and when I do ...

热门标签