Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7368111
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 29, 20262026-05-29T03:37:25+00:00 2026-05-29T03:37:25+00:00

<table> <tr> <td>&nbsp;</td> <td> <a id=<%= id%> href=javascript:redirect() > <img src=<%= s%> style=width:90px; height:90px;

  • 0
<table>
     <tr>
         <td>&nbsp;</td>
         <td>
             <a id=<%= id%> href="javascript:redirect()" >      
                 <img src=<%= s%> style="width:90px; height:90px;" />  
             </a>
         </td>
         <td>
             <p>Product Name  : <%= name %></p>
             <p>Product Price : <%= list.get(i).getProdPrice() %></p>
         </td>
    </tr>
</table>

I need to get the value of <%= id%> in jsp code [<a id=<%= id%> href="javascript:redirect()" >] in my javascript. I am calling a javascript redirect(),

How can I get the value of id in my javascript? This is my javascript.

function redirect(){
    var a = document.getElementById("id").value;  
    alert(a);   
 }

I need to get the value in javascript function and need to submit the page from javascript.

I am using struts2 framework.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-29T03:37:25+00:00Added an answer on May 29, 2026 at 3:37 am

    If I understand the question correctly, you need to pass the value <%= id%> to your javascript function. you can do this by making the following changes to your code

    change the javascript function to :

     function redirect(id){
        alert(id);    /* or any other processing you need */
     }
    

    and attach redirect in the JSP as

    <table>
         <tr>
             <td>&nbsp;</td>
             <td>
                 <a href="javascript:redirect(<%= id%>)" >      
                        <%-- CHANGE MADE ABOVE -- %>
    
                     <img src=<%= s%> style="width:90px; height:90px;" />  
                 </a>
             </td>
             <td>
                 <p>Product Name  : <%= name %></p>
                 <p>Product Price : <%= list.get(i).getProdPrice() %></p>
             </td>
        </tr>
    </table>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a table as below; <tr class=nm style=height: 30px> <td style=width: 15px;>&nbsp;</td> <td
<div id=m101> <table class=tablec width=80% border=0 cellspacing=0 cellpadding=0> <tr> <td><a href=#><span class=name>My Name</span></a></td> <td>&nbsp;</td>
<div style=text-align:center;> <select id=sponsorList></select>&nbsp;<img alt=Loading... src=../../Img/ajax-loader.gif id=loader /> <span style=display:none; id=selectedSponsorId></span> <div id=sponsorRowDetails style=margin-left:auto;
My code is as follows: <table> <tr> <td> <div id='lunch'><a href='Lunchplace.aspx?c=1&id=110'><img style='margin-top: 3px;' src='./images/115x52_Brasseriet.jpg'class='imagealign'/><b>Brasseriet</b><br
I have this table : <table> <thead> <tr> <th>Quantity</th> <th>&nbsp;</th> <th>Price</th> <th>Sum</th> </tr></thead> <tbody>
I am displaying all values in table formated View: <div style=clear:both; padding-top:1px;>&nbsp;</div> <%if @signals[0]!=nil
<table cellpadding=1 cellspacing=1 id=member><thead> <tr> <th>&nbsp;</th> <th>Gracz</th> <th>Ludność</th> <th>Osady</th><th>&nbsp;</th></tr></thead><tbody><tr> <td class=ra>1.</td><td class=pla><a href=spieler.php?uid=5473>rafal12</a></td><td class=hab>8801</td>
<table class=tableData id=addUserTable > <tr> <th class = name=errorMsgUser id=errorMsg value= colspan=2>&nbsp;</th> </tr> <tr>
<table class=subTable> <tr><td>09:00</td><td>-</td><td>18:00</td></tr> <tr><td colspan=3><!-- 呜呜呜旺旺旺旺王旺旺旺旺wwwwww -->呜呜呜旺...</td></tr> <tr class=nomoreEvents style=display:none;><td colspan=3><span class=hideId>456</span>&nbsp;</td></tr> </table> how
I've got a table <table id=mytable> <tr style=display: none;><td>&nbsp;</td></tr> <tr><td>&nbsp;</td></tr> <tr style=display: none;><td>&nbsp;</td></tr> <tr><td>&nbsp;</td></tr>

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.