我如何设置样式<a> which is retrieved from database?

时间:2015-07-02 13:31:11

标签: html css asp-classic external

I couldn't figure out how do I style a link which is pulled out from database. It might be simple but I have been struggling in it. I will be thankful if someone points out my mistake as I am not expecting coding help. I am attaching my snippet so that other can see what I am trying to do.

tda2a a{font-size: 5px !important; color:red !important;}
Response.Write "<tr>" & _
    "<td id=""hometda2"" align=""right"" style=""width:75px;padding:15px 0"">" & _
    "<a id=""tda2a"" href=""http://www.example.com/" & RS("pal") & "-" & RS("productID") & """></a>" & _
    "</td>" & _
    "<td>" & RS("qty") & " - <a href=""http://""www.example.com/""" & RS("pal") & "-" & RS("productID") & """>" & RS("name")
IF RS("taste") <> "" THEN
    Response.Write " " & RS("taste")
END IF
Response.Write " by " & RS("brand") &"</a><br/>"

2 个答案:

答案 0 :(得分:1)

在你的CSS中,

@Configuration
@EnableWebSecurity
@EnableGlobalMethodSecurity(securedEnabled = true)
public class AppSecurityConfiguration extends WebSecurityConfigurerAdapter{..

正在寻找以下html:

Public Class Form1

Dim authorized As Boolean = False
Dim PhantomPass As String = ""


   Private Sub TextBox1_KeyDown(sender As Object, e As KeyEventArgs) Handles TextBox1.KeyDown
       If e.Modifiers = Keys.Control Then
          e.SuppressKeyPress = True
          authorized = False
       Else
          authorized = True
       End If
   End Sub

    Private Sub TextBox1_KeyPress(sender As Object, e As KeyPressEventArgs) Handles TextBox1.KeyPress
        If authorized = True Then
           PhantomPass += e.KeyChar
           Label1.Text = PhantomPass
        End If
    End Sub

    Private Sub Button1_Click(sender As Object, e As EventArgs) Handles Button1.Click
        authorized = True
        TextBox1.Text += "x"
        PhantomPass += "x"
        Label1.Text = PhantomPass
    End Sub


    Private Sub Form1_Load(sender As Object, e As EventArgs) Handles MyBase.Load
        TextBox1.AutoCompleteMode = AutoCompleteMode.None
        TextBox1.AllowDrop = False
    End Sub
    End Class

显然,这不是你的html所包含的内容。 :)

如果你想使用id = hometda2定位td中的所有链接,你可以写

tda2a a

如果你想专门定位id = tda2a的链接,你可以写

<tda2a><a href="...">...</a></tda2a>

如果您实际上写了一堆链接,请考虑使用类名而不是id(因为后者必须是唯一的),并为所有链接使用完全相同的类名。

#hometda2 a {...}
a#tda2a {...}

答案 1 :(得分:0)

在您上面粘贴的片段中,您的ID是: ID =&#34;&#34; hometda2&#34;&#34;

这应该是

  

ID =&#34; hometda2&#34;

目前你的css规则是: tda2a a {font-size:5px!important;颜色:红色!重要;}

这应该是

  

#tda2a a {font-size:5px!important;颜色:红色!重要;}