开发者

javascript - Is there a way to grab these values with php?

I have this JS code which works by using the onclick method and opens an image in a new window which is the exact size of the image.

I adapted it from the BolGallery script. but the bolGallery script parses this in PHP and is able to get the the 'title','width' and 'height' values dynamically. and also the 'ImageFile' value.

My question is, is there a way to get these with php?

Im not very knowledgeable with JS

function GalleryPopup(imageFile, width, height, title){

    var html = '<title>' + title + ' - Click to close </title><body leftmargin=0 topmargin=0 marginwidth=0 marginheight=0 onclick=\"javascript:window.close()\"><img src=\"' + imageFile + '\" alt=\"Click to close\"><开发者_开发问答;/body>';
    var popup = window.open(imageFile, '_blank', 'width=' + width+ ', height=' + height + ', status=no');
    popup.document.write(html);
    popup.focus();
}

alternatively, if you know of any other ways to achieve what i'm going for then feel free to tell me.

For Instance i dont know what to set the variable like:

$imagetitle = 

Would that work?

i also have jQuery..


in jQuery you can get size of image with:

$('img').width();
$('img').height();

// this is used to grab the source file and title:

$('img').attr('src');
$('img').attr('title');
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜