将文本框的值右键输入到“img src”中。 [英] enter the values of the textboxes right into an "img src"

查看:61
本文介绍了将文本框的值右键输入到“img src”中。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在尝试将文本框的值输入img src



 <   asp:TextBox     ID   =  TextBox1   文本  =  40.78 < span class =code-attribute>   runat   =  server >  <   / asp:TextBox  >  
< asp:TextBox ID = TextBox2 文字 = - 81.5 runat = 服务器 > < / asp:TextBox >
< img src = http://www.latlong.net/c/?lat= & <% = TextBox1.ClientID% > & long =& <% = TextBox2.ClientID%> &安培; alt =latlong/>

解决方案

将img设置为runat = server并在代码中更好地设置这些值在后面。


你可以这样做:

 <   asp:textbox     id   =  TextBox1    text   =  40.78    runat   =  server >  <   / asp:textbox  >  
& lt; asp:textbox id = TextBox2 text = - 81.5 runat = 服务器 > < / asp:文本框 >
< asp:image id = img1 runat = server imageurl = / >

< asp:按钮 id = Button1 runat = server text = go / >





按钮点击

代码背后:



 受保护的  Sub  Button1_Click(发件人作为 对象,e 作为 EventArgs)句柄 Button1.Click 
img1.ImageUrl = http://www.latlong.net/c/?lat= + textbox1.text + long = + textbox2.text + alt = latlong
结束 Sub


< blockquote>我假设你正在进行地理定位?



你可以这样做:

 <   asp:textbox     id   =  TextBox1    text   =  40.78    runat   = 服务器    xmlns:asp   = #unknown >  < ;   / asp:textbox  >  
< asp:textbox id = TextBox2 text = -81.5 runat = server xmlns:asp < span class =code-keyword> = #unknown > < / asp:textbox >
< asp:image < span class =code-attribute> id = img1 runat = 服务器 imageurl = xmlns:asp = #unknown / >

< asp:按钮 id = Button1 runat = server text = go xmlns:asp = #unknown / >





按钮点击

代码落后:



 受保护的  Sub  Button1_Click(发件人作为 对象,e  As  EventArgs)句柄 Button1.Click 
img1.ImageUrl = http://www.latlong.net/c/?lat= + textbox1.text + long = textbox2.text + alt = latlong
结束 Sub


I am trying to enter the values of the textboxes right into an "img src"

<asp:TextBox ID="TextBox1" Text="40.78" runat="server"></asp:TextBox>
<asp:TextBox ID="TextBox2" Text="-81.5" runat="server"></asp:TextBox>
<img src="http://www.latlong.net/c/?lat=" & <%=TextBox1.ClientID%> & "long=" & <%=TextBox2.ClientID%> & " alt="latlong" />

解决方案

set img as runat=server and better set these values in code behind .


you could do something like this:

<asp:textbox id="TextBox1" text="40.78" runat="server"></asp:textbox>
    <asp:textbox id="TextBox2" text="-81.5" runat="server"></asp:textbox>    
    <asp:image id="img1" runat="server" imageurl="" />

<asp:button id="Button1" runat="server" text="go" />



on button click
code behind:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        img1.ImageUrl = "http://www.latlong.net/c/?lat=" + textbox1.text + "long=" + textbox2.text + "alt=latlong"
    End Sub


im assuming you are geolocating?

you could do something like this:

<asp:textbox id="TextBox1" text="40.78" runat="server" xmlns:asp="#unknown"></asp:textbox>
    <asp:textbox id="TextBox2" text="-81.5" runat="server" xmlns:asp="#unknown"></asp:textbox>    
    <asp:image id="img1" runat="server" imageurl="" xmlns:asp="#unknown" />

<asp:button id="Button1" runat="server" text="go" xmlns:asp="#unknown" />



on button click
code behind:

Protected Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        img1.ImageUrl = "http://www.latlong.net/c/?lat=" + textbox1.text + "long=" textbox2.text + "alt=latlong"
    End Sub


这篇关于将文本框的值右键输入到“img src”中。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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