我已经将字符串变量传递给html页面以链接到灯箱. [英] i have pass the string variable to html page for link for the light box.

查看:48
本文介绍了我已经将字符串变量传递给html页面以链接到灯箱.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

这是可能页面的脚本

this is the script for the may page

<%@ Page Language="VB" AutoEventWireup="false" CodeFile="test.aspx.vb" Inherits="test" %>

<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
    <title>Untitled Page</title>
    <script src="js/stuHover.js" type="text/javascript"></script>
    <link rel="stylesheet" type="text/css" href="../style-projects-jquery.css" />

    <!-- Arquivos utilizados pelo jQuery lightBox plugin -->
    <script type="text/javascript" src="js/jquery.js"></script>
    <script type="text/javascript" src="js/jquery.lightbox-0.5.js"></script>
    <link rel="stylesheet" type="text/css" href="css/jquery.lightbox-0.5.css" media="screen" />
    <!-- / fim dos arquivos utilizados pelo jQuery lightBox plugin -->

    <!-- Ativando o jQuery lightBox plugin -->
    <script type="text/javascript">
    $(function() {
        $('#gallery a').lightBox();
    });
    </script>
</head>
<body>
<!-- Here s as string variable  -->
<%  s%>
    <form id="form1" runat="server">
    <div>
    <div id="gallery">

        <asp:Button ID="Button1" runat="server" Text="Button" />
        <a href=>
        <asp:Image ID="Image1" runat="server"

            ImageUrl="~/gallery/Necklace/necklace13.jpg" />
            </a>
    </div>
    </div>
    <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True">
        <asp:ListItem>1</asp:ListItem>
        <asp:ListItem>2</asp:ListItem>
        <asp:ListItem>3</asp:ListItem>
    </asp:DropDownList>
    </form>
</body>
</html>




这是我声明变量的代码




And this is the code where i have declare the variable

Partial Class test
    Inherits System.Web.UI.Page
    Public s As String

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Image1.ImageUrl = "gallery/Ring/ring5.jpg"
        MsgBox(s)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        s = Image1.ImageUrl
    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        If DropDownList1.SelectedValue = "1" Then
            Image1.ImageUrl = "gallery/Ring/ring5.jpg"

        ElseIf DropDownList1.SelectedValue = "2" Then
            Image1.ImageUrl = "gallery/Necklace/necklace2.jpg"

        ElseIf DropDownList1.SelectedValue = "3" Then
            Image1.ImageUrl = "gallery/bangal/bangal6.jpg"

        End If
    End Sub
End Class



请帮帮我

先生.....

谢谢....



Please help me

sir.....

Thanks ....

推荐答案

(函数(){


(' #gallery a').lightBox(); }); < / 脚本 > < /head > < 正文 > <!- 此处为字符串变量 -> <% s %> < 表单 =" form1" runat >服务器" > < div > < div =" 图库" < asp:Button ID =" runat 服务器" 文本 按钮" / < a = > ; < asp:Image ID =" runat 服务器" =" 〜/gallery/Necklace/necklace13.jpg" / > < /a > < /div > < /div > < asp:DropDownList ID =" runat 服务器" AutoPostBack True" < asp:ListItem > 1 < /asp:ListItem > < asp:ListItem > 2 < /asp:ListItem > < asp:ListItem > 3 < /asp:ListItem > < /asp:DropDownList > < /form > < /body > < /html >
('#gallery a').lightBox(); }); </script> </head> <body> <!-- Here s as string variable --> <% s%> <form id="form1" runat="server"> <div> <div id="gallery"> <asp:Button ID="Button1" runat="server" Text="Button" /> <a href=> <asp:Image ID="Image1" runat="server" ImageUrl="~/gallery/Necklace/necklace13.jpg" /> </a> </div> </div> <asp:DropDownList ID="DropDownList1" runat="server" AutoPostBack="True"> <asp:ListItem>1</asp:ListItem> <asp:ListItem>2</asp:ListItem> <asp:ListItem>3</asp:ListItem> </asp:DropDownList> </form> </body> </html>




这是我声明变量的代码




And this is the code where i have declare the variable

Partial Class test
    Inherits System.Web.UI.Page
    Public s As String

    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click

        Image1.ImageUrl = "gallery/Ring/ring5.jpg"
        MsgBox(s)
    End Sub

    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        s = Image1.ImageUrl
    End Sub

    Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
        If DropDownList1.SelectedValue = "1" Then
            Image1.ImageUrl = "gallery/Ring/ring5.jpg"

        ElseIf DropDownList1.SelectedValue = "2" Then
            Image1.ImageUrl = "gallery/Necklace/necklace2.jpg"

        ElseIf DropDownList1.SelectedValue = "3" Then
            Image1.ImageUrl = "gallery/bangal/bangal6.jpg"

        End If
    End Sub
End Class



请帮帮我

先生.....

谢谢....



Please help me

sir.....

Thanks ....


这里是一种方法:

http://social.msdn.microsoft.com/Forums/zh/wpf/thread/0b8877b6-095c-4d77-8bbe-536dfcf4c208 [
Here is one way to do it:

http://social.msdn.microsoft.com/Forums/en/wpf/thread/0b8877b6-095c-4d77-8bbe-536dfcf4c208[^]

Using binding requires a own string class, but once it set up, you dont need to think about how often it changes...

Otherwise you will have to hard code and set the string s each time it changes...


这篇关于我已经将字符串变量传递给html页面以链接到灯箱.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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