我通过搜索获得的此代码..
<html>
<head>
<title>Get url for address bar</title>
<script>
function display(folder,img_name)
{
var src = "http://localhost/UPLOADER/images/"+folder+"/"+img_name;
show_image("http://localhost/UPLOADER/images/"+folder+"/"+img_name, 276,110, "Img");
}
function show_image(src, width, height, alt)
{
var img = document.createElement("img");
img.src = src;
img.width = width;
img.height = height;
img.alt = alt;
document.body.appendChild(img);
}
</script>
</head>
<body>
<input type="text" name="image" value="" style="margin-top: 4px;" placeholder="Image_name" />
<button onclick="display('a','access')">DISPLAY IMAGE</button>
</body>
</html>
我从站点为 jquery获取的这段代码运行良好,但我认为我在代码中犯了一些错误,当它显示时很难抓住错误。未定义的图像和功能显示。
我想添加它以动态选择图像
<?php
$img_name=$_POST['image'];
$folder = substr($img_name, 0, 1);
?>
<button onclick="display('$folder','$img_name')">DISPLAY IMAGE</button>
对于扩展,我使用 .htaccessOptions +MultiViews
谢谢