Solved

How to use Onclick on text

Posted on 2013-12-06
4
237 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
Comment Utility
<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
Comment Utility
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
Comment Utility
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
Comment Utility
thanks
0

Featured Post

Highfive Gives IT Their Time Back

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Have you tried to learn about Unicode, UTF-8, and multibyte text encoding and all the articles are just too "academic" or too technical? This article aims to make the whole topic easy for just about anyone to understand.
Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
In this tutorial viewers will learn how to embed Flash content in a webpage using HTML5. Ensure your DOCTYPE declaration is set to HTML5: "<!DOCTYPE html>": Use the <object> tag to embed Flash content.: To specify that the object is Flash content, d…
The viewer will the learn the benefit of plain text editors and code an HTML5 based template for use in further tutorials.

763 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

9 Experts available now in Live!

Get 1:1 Help Now