aspose file tools*
The moose likes HTML, CSS and JavaScript and the fly likes handler for onclick Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of EJB 3 in Action this week in the EJB and other Java EE Technologies forum!
JavaRanch » Java Forums » Engineering » HTML, CSS and JavaScript
Bookmark "handler for onclick" Watch "handler for onclick" New topic
Author

handler for onclick

Gilles Charbonneau
Greenhorn

Joined: Jun 22, 2001
Posts: 4
Hello pples!
I have made small code allowing text in a table row to change color on mouse overs, that part goes well but i am havin problems making the link (onclick) part workin, help would be greatly apreciated!
Here's the code
< !DOCTYPE html PUBLIC "-//W3C//DTD HTML 3.2//EN">
< html>
< head>
< title>Untitled Document< /title>
< meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
< /head>
< body bgcolor="#FFFFFF" text="#000000">
< table width="300" border="1" cellspacing="0" cellpadding="0" height="255">
< tr>
< td width="100" height="100">�< /td>
< td width="100" height="100">�< /td>
< td width="100" height="100">�< /td>
< /tr>
< tr>
< td width="100" height="100">�< /td>
< td bgcolor="#FFCC00" width="150" <br /> onmouseover="this.style.color='#ff0000'" <br /> onmouseout="this.style.color='#0000ff'" <br /> onclick="this.href='http://www.altavista.com'"> ***** not working *****
< center>< b>Link1< /b>< /center>
< /td>
< td width="100" height="100">�< /td>
< /tr>
< tr>
< td width="100" height="100">�< /td>
< td width="100" height="100">�< /td>
< td width="100" height="100">�< /td>
< /tr>
< /table>
< /body>
< /html>
[This message has been edited by Gilles Charbonneau (edited June 23, 2001).]
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Perhaps if you put some spaces after your angle brackets so that this html doesn't EXECUTE this might be easier to read .


"JavaRanch, where the deer and the Certified play" - David O'Meara
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Well, I an no HTML expert by any means, but I thought that that is what anchor tags are for.
onmouseover="this.style.color='#ff0000'"
onmouseout="this.style.color='#0000ff'"
< center>< b>< a href="http://www.altavista.com">Link1< /a>< /b>< /center>
You know we have an HTML forum for questions like this. Randy does LOTS more with this stuff than I do.
[This message has been edited by Cindy Glass (edited June 23, 2001).]
Gilles Charbonneau
Greenhorn

Joined: Jun 22, 2001
Posts: 4
Hello again!
thanks for the help but this isnt what i ment
What i wanna do is to make the table row clickable!
------------------
Jim Yingst
Wanderer
Sheriff

Joined: Jan 30, 2000
Posts: 18671
Well, the comment about the HTML forum is still valid. Why not post in a forum which specializes in what you're doing?


"I'm not back." - Bill Harding, Twister
Dan
Greenhorn

Joined: May 31, 2002
Posts: 2

That should cover you. on-click shouldn't have a dash, but this @#$@#$ forum wouldn't take my post.
Cindy Glass
"The Hood"
Sheriff

Joined: Sep 29, 2000
Posts: 8521
Thanks Dan, Welcome to the Java Ranch,
we hope you’ll enjoy visiting as a regular however, your name is not in keeping with our naming policy here at the ranch. Please change your display name to an appropriate name as shown in the policy.
Thanks again and we hope to see you around the ranch!!
Cindy
Thomas Paul
mister krabs
Ranch Hand

Joined: May 05, 2000
Posts: 13974
Moving this to the HTML forum.


Associate Instructor - Hofstra University
Amazon Top 750 reviewer - Blog - Unresolved References - Book Review Blog
Rob Hunter
Ranch Hand

Joined: Apr 09, 2002
Posts: 805
Hi Gilles,
I haven't used this much but have you tried using the <div> tag. I'm not 100% sure if <td> tags use onclick events since I've never had any use of onclicks for this type of case.
Rob
Charlie Sturman
Ranch Hand

Joined: Apr 04, 2002
Posts: 112
change this.href to window.location
"window.location='http://www.altavista.com'"
 
It is sorta covered in the JavaRanch Style Guide.
 
subject: handler for onclick
 
Similar Threads
handler for onclick
tiles and <sx:autocompleter>
JSP Error
Can you send post method with javascript?
Getting Values from a window to parent page