javascript on click

When toner is onclick, I want to capture 'name' and 'brand'. how can I code in javascript?
Below codes is in ascx and within master page with form name: form1

      <select name="brand">
        <option value="HP">HP</option>
        <option value="Canon">Canon</option>
      <a href="Category.aspx?name=Toner"" id=">Toner</a>
Who is Participating?
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

test page :
please note I added ID attribute to the elements

window.onload = function() {
   document.getElementById("toner").onclick = function() {
         var brand = document.getElementById("brand");
         brand = brand.options[brand.selectedIndex].value;
         // checking :
         alert( brand );

Open in new window

ITsolutionWizardAuthor Commented:
not working. please provide complete codes link included jquery.
And I want to redirect to category.asp not alert. thanks,
what do you mean by "not working" ?
do you mean on your side ? did you read all my comment regarding the ID ?
could you provide a link to your page to check ?
Determine the Perfect Price for Your IT Services

Do you wonder if your IT business is truly profitable or if you should raise your prices? Learn how to calculate your overhead burden with our free interactive tool and use it to determine the right price for your IT services. Download your free eBook now!

ITsolutionWizardAuthor Commented:
<a href="Category.aspx?name=Toner"" id=">Toner</a> and I want to get value from name as well. maybe I should rename to productType=Toner
ITsolutionWizardAuthor Commented:
<asp:DropDownList runat="server" ID="brand">
                                                <asp:ListItem selected="True" Text="HP" Value="HP"></asp:ListItem>
                                                <asp:ListItem Text="Canon" Value="Canon"></asp:ListItem>

<asp:DataList Width="800px" runat="server" ID="dataListBrand" RepeatColumns="8" RepeatDirection="Vertical" >
                                             <a href="Brand.aspx?Name=<%# Eval("name") %>">
                                             <asp:Label Width="140px" runat="server" ID="repeatListItemCategory" Text='<%# Bind("name") %>'></asp:Label>                                            

Let me put the exact codes for you to review.

If <a href="Brand.aspx?Name=<%# Eval("name") %>"> is clicked, it is a link then I
want to capture both values from <a href="Brand.aspx?Name=<%# Eval("name") %>"> and brand.

Sorry for any confuse.
Vishal PatilSoftware EngineerCommented:
Hello  ITsolutionWizard,

Please check with following code:

    <script type="text/javascript">
        function SayHello(txt, contact) {
            document.getElementById("<%= brand.ClientID %>");
            alert(document.getElementById("<%= brand.ClientID %>").value);
  , "Tesst");
            return false;

Open in new window

Source :

<asp:DropDownList runat="server" ID="brand">
        <asp:ListItem Selected="True" Text="HP" Value="HP"></asp:ListItem>
        <asp:ListItem Text="Canon" Value="Canon"></asp:ListItem>
    <asp:DataList Width="800px" runat="server" ID="dataListBrand" RepeatColumns="8" RepeatDirection="Vertical">
            <li><a href="" onclick='javascript:return SayHello("<%# Eval("name") %>","Brand.aspx?Name=<%# Eval("name") %>");'>
                <asp:Label Width="140px" runat="server" ID="repeatListItemCategory" Text='<%# Bind("name") %>'></asp:Label>

Open in new window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
ITsolutionWizardAuthor Commented:
quick and accurate
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today

From novice to tech pro — start learning today.