?
Solved

How to use Onclick on text

Posted on 2013-12-06
4
Medium Priority
?
244 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 1400 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 600 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

Get real performance insights from real users

Key features:
- Total Pages Views and Load times
- Top Pages Viewed and Load Times
- Real Time Site Page Build Performance
- Users’ Browser and Platform Performance
- Geographic User Breakdown
- And more

Question has a verified solution.

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

Is your Office 365 signature not working the way you want it to? Are signature updates taking up too much of your time? Let's run through the most common problems that an IT administrator can encounter when dealing with Office 365 email signatures.
Today, the web development industry is booming, and many people consider it to be their vocation. The question you may be asking yourself is – how do I become a web developer?
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…
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 …
Suggested Courses

801 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