By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
462,257 Members | 524 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 462,257 IT Pros & Developers. It's quick & easy.

Make button invisible in php

100+
P: 250
I have a menu which is contain image buttons. I want to hide some buttons in some pages. This is my code and it's not working. I couldn't find the error. Please help me.
Expand|Select|Wrap|Line Numbers
  1. <script type="text/javascript">
  2.      document.form1.btn1.style.visibility="hidden";
  3. </script>
  4. <body><form name="form1" >
  5.  
  6.                 <table border="0" cellpadding="0" cellspacing="3">
  7.                     <tbody>
  8.                         <tr>
  9.                             <td><html:link action="/loadp1"><img src="images/Btn1.jpg" width="120" height="20"  border="0"  name="btn1"/></html:link></td>
  10.                             <td><html:link action="/admin"><img src="images/AdminBtn.jpg" width="120" height="20"  border="0" id="admin"/></html:link></td>
  11.                             .............
  12.                         </tr>
  13.                     </tbody>
  14.                 </table>
  15.         </form>
  16.  
  17.     </body>
  18.  
May 3 '10 #1
Share this Question
Share on Google+
6 Replies

gits
Expert Mod 5K+
P: 5,390
give it an id and use:
Expand|Select|Wrap|Line Numbers
  1. document.getElementById('yourId').style.visibility='hidden';
kind regards
May 3 '10 #2

Dormilich
Expert Mod 5K+
P: 8,639
Expand|Select|Wrap|Line Numbers
  1. <html:link action="/loadp1">
I donít know what this is, but itís not HTML (as it is now)
May 3 '10 #3

gits
Expert Mod 5K+
P: 5,390
looks like struts-syntax ...and should render as a simple anchor tag?

kind regards
May 3 '10 #4

100+
P: 250
@gits
I put
Expand|Select|Wrap|Line Numbers
  1. document.getElementById(btn1).style.visibility='hidden';
  2.  
. and change the image id as btn 1. but it's not working.
May 4 '10 #5

100+
P: 250
@Dormilich
It's struts syntax. just a normal page load
May 4 '10 #6

gits
Expert Mod 5K+
P: 5,390
@ghjk
you have to pass the id as a string:

Expand|Select|Wrap|Line Numbers
  1. document.getElementById('btn1').style.visibility='hidden';
  2.  
May 5 '10 #7

Post your reply

Sign in to post your reply or Sign up for a free account.