Solved

How to use Onclick on text

Posted on 2013-12-06
4
238 Views
Last Modified: 2013-12-06
Hi!

Have this code line:

<td class="rapport1_del5" align="left">
<a href="#" target="_self"> <img src="../images/skriver.png" TYPE="button" align="left" onClick="window.print()" /> Printer </a></td>

Open in new window


When the user clicks on the picture, its running -> windows.print()

But i want the same to happend when user only click on the text -> Printer

How do i do this ?
0
Comment
Question by:team2005
  • 2
4 Comments
 
LVL 25

Accepted Solution

by:
Lee Savidge earned 350 total points
ID: 39700439
<td class="rapport1_del5" align="left">
<a href="#" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a></td>

Open in new window

0
 
LVL 30

Assisted Solution

by:Alexandre Simões
Alexandre Simões earned 150 total points
ID: 39700440
Put the onClick event handler on the <a>
<a href="#" target="_self" onClick="window.print()"> <img src="../images/skriver.png" TYPE="button" align="left" /> Printer </a>

Open in new window

0
 
LVL 30

Expert Comment

by:Alexandre Simões
ID: 39700442
Although if you're not actually using the <a> for nothing I would suggest to use a div or a span.

I don't like to see the # at the end of the URLs and that's what happens when you click that Printer link.
0
 
LVL 2

Author Closing Comment

by:team2005
ID: 39700580
thanks
0

Featured Post

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Tags from access to excel 3 28
Split in Javascript 5 31
Centering Vertically 3 28
html input type 3 22
JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Finding original email is quite difficult due to their duplicates. From this article, you will come to know why multiple duplicates of same emails appear and how to delete duplicate emails from Outlook securely and instantly while vital emails remai…
In this tutorial viewers will learn how add a scalable full-width header using CSS3. Create a new HTML document with an internal stylesheet. Set a tiled background.:  Create a new div and name it Header. Position it with position:absolute at the top…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

910 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

25 Experts available now in Live!

Get 1:1 Help Now