Javascript 在img中使用php函数;src";标签
我不想手动指定文件名,而是希望使用返回文件名字符串的函数动态加载文件-Javascript 在img中使用php函数;src";标签,javascript,php,html,Javascript,Php,Html,我不想手动指定文件名,而是希望使用返回文件名字符串的函数动态加载文件- <a > <figure> <img src=\"images/parfumes/car.png\" class=\"parfume$ProductID\" value=\"$ProductPrice \" height=\"225\"
<a >
<figure>
<img src=\"images/parfumes/car.png\" class=\"parfume$ProductID\" value=\"$ProductPrice \" height=\"225\" width=\"225\">
<figcaption >Цена: $ProductPrice лв.</figcaption>
</figure>
</a>";
我想要这样的东西:
<img src=\"images/parfumes/getPpicture(somedigit)\" class=\"parfume2\" value=\"$ProductPrice\" height=\"225\" width=\"225\">
<figcaption >$ProductPrice.ЛВ</figcaption>
</figure>";
$ProductPrice.Лb
";
任何语法正确的想法都可以通过两个步骤完成:
img
标签分配id(无需,但更方便)
尝试删除所有\类=\\'parfume$ProductID\”
是的,我得到了css。
<img src=\"images/parfumes/getPpicture(somedigit)\" class=\"parfume2\" value=\"$ProductPrice\" height=\"225\" width=\"225\">
<figcaption >$ProductPrice.ЛВ</figcaption>
</figure>";