点击图片时如何调整大小? [英] how to make resize picture when i click on picture?

查看:79
本文介绍了点击图片时如何调整大小?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

嗨大家好,我已将图片保存在一个(图片)文件夹中,这些图片显示在页面上,当我运行我的asp申请表格时,现在我想要点击图片这张图片增加尺寸我不知道这个,有些人可以通过代码帮助我解决这个问题。

解决方案

不要这样做:相反,保持文件夹中的全尺寸图片,并且创建您在页面上显示的缩略图图像。缩略图链接到完整尺寸的图像,浏览器将自动为您打开完整尺寸版本:

 <   a     href   =  http://www.MyDomain.com/images/thumbs/MyPictureName.jpg >  <   img     src   =  http: //www.MyDomain.com/images/MyPictureName.jpg\"   border   =  0    alt   = 点击查看完整图片 >  <   / a  >  


Griff回答是对的。



HI试试这个..

它可能对你有帮助..

下面的代码在javascript中执行两个预定义大小的图像的切换操作。

如果你不需要切换,你可以在javascript中修改...



 <%@       语言  =  C#    AutoEventWireup   =  true    CodeBehind   =  WebForm1.aspx.cs   继承  =  WebApplication1.WebForm1   %>  

< !DOCTYPE < span class =code-attribute> html >

< html xmlns = http://www.w3.org/1999/ xhtml >
< head runat = 服务器 >
< title > < / title >
< script src = jquery.js.js > ; < / script >
< script type = text / javascript >
var Resize = function (imageobject){
if (imageobject.style.height == ' 50px'){
imageobject.style.height = ' 200px';
imageobject.style.width = ' 200px';
}
else {
imageobject.style.height = ' 50px';
imageobject.style.width = ' 50px';
}
}
< / script >

< / head >
< 正文 >
< 表格 id = form1 runat = server >
< asp:Image ID = Image1 onclick = 调整大小(this); 样式 = 身高:50px; width:50px; ImageUrl = 〜/ images / codeproject 2nd.png runat = server / >
< / form >

< / body >
< / html >


Hi Every one, I have saved pictures in one (Image)folder and these pictures showed on page when I run my asp application form, Now I want when I click on picture this picture increase size I don't know about this, please can some one help me on this topic with code.

解决方案

Don't do it that way: instead, keep the full size picture in the folder, and create a thumbnail image which you show on the page. The thumbnail links to the full size image, and the browser will automatically open the full size version for you:

<a href="http://www.MyDomain.com/images/thumbs/MyPictureName.jpg"><img src="http://www.MyDomain.com/images/MyPictureName.jpg" border="0" alt="Click for full image"></a>


Griff answer is right.

HI Try this..
It might help you..
the below code does the toggle operation of two predefined sizes of the images in javascript.
if you dont need toggle, u can modify in the javascript...

<%@ Page Language="C#" AutoEventWireup="true" CodeBehind="WebForm1.aspx.cs" Inherits="WebApplication1.WebForm1" %>

<!DOCTYPE html>

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title></title>
    <script src="jquery.js.js"></script>
    <script type="text/javascript">
        var Resize = function (imageobject) {
            if (imageobject.style.height == '50px') {
                imageobject.style.height = '200px';
                imageobject.style.width = '200px';
            }
            else {
                imageobject.style.height = '50px';
                imageobject.style.width = '50px';
            }
        }
    </script>

</head>
<body>
    <form id="form1" runat="server">
        <asp:Image ID="Image1" onclick="Resize(this);" Style="height: 50px; width: 50px;" ImageUrl="~/images/codeproject 2nd.png" runat="server" />
    </form>

</body>
</html>


这篇关于点击图片时如何调整大小?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆