Solved

How to use Onclick on text

Posted on 2013-12-06
4
241 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
JS library vs Js framework 11 20
How to check or uncheck a checkbox using the id of the checkbox 2 16
Accordion won't close correctly 5 12
Echo'd values in dropdowns 6 27
This article discusses four methods for overlaying images in a container on a web page
Boost your ability to deliver ambitious and competitive web apps by choosing the right JavaScript framework to best suit your project’s needs.
In this Micro Tutorial viewers will learn how to create navigation buttons that change on rollover, using CSS (Continuation of the CSS Image Sprite tutorial) Create a parent ID for all the list items       - Specify position: absolute and display: block…
In this tutorial viewers will learn how to code links for mobile sites that, once clicked, send a call or text to a specified number. For a telephone link (once clicked, calls a number), begin with a normal "<a href=" link tag. For the href, specify…

735 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