Click to See Complete Forum and Search --> : Newbie Stuff, About a button
NewbieLearner
03-28-2004, 02:47 PM
hi, this little script is for a button, text in the middle, highlights when mouse over and then takes to a url when clikc the text. But i want to know how to make it, so that when the mouse is over anywhere on the button, its takes to url on link.
<center><table cellspacing=1 cellpadding=2 bgcolor=white border=0 width=800><tbody><tr align="center">
<td
onMouseOver="this.style.backgroundColor='royalblue'"
onMouseOut="this.style.backgroundColor='blue'"
bgcolor=blue><a href="tha link"><b><font size=2px>tha text</font></b></a></td>
</tbody></tr></table></center>
-Cheers!
batfink
03-28-2004, 04:40 PM
I'm sure you already know this but your href attribute is not valid at the moment (need a page name like thalink.html)
<center><table cellspacing=1 cellpadding=2 bgcolor=white border=0 width=800><tbody><tr align="center">
<td
onMouseOver="this.style.backgroundColor='royalblue'"
onMouseOut="this.style.backgroundColor='blue'"
bgcolor=blue><a href="tha link" onMouseOver="javascript:window.location=this.href"><b><font size=2px>tha text</font></b></a></td>
</tbody></tr></table></center>
batfink
03-28-2004, 04:46 PM
...or whole "button" (your table). Did you know actual buttons can be styled and sized.
<center><table cellspacing=1 cellpadding=2 bgcolor=white border=0 width=800><tbody><tr align="center">
<td
onMouseOver="this.style.backgroundColor='royalblue';window.location='thalink.html';"
onMouseOut="this.style.backgroundColor='blue'"
bgcolor=blue><a href="http://www.google.co.uk"><b><font size=2px>tha text</font></b></a></td>
</tbody></tr></table></center>
batfink
03-28-2004, 05:00 PM
As a button:
<center>
<input onMouseOver="this.style.backgroundColor='royalblue';window.location='thalink.html'" onMouseOut="this.style.backgroundColor='blue'" type="button" value="thalink.html" style="background-color:blue;width:800px">
</center>
NewbieLearner
03-28-2004, 05:09 PM
thanks, but the first one has no effect, and the other two take to the url on mouse over :confused: And how comes if i place in 'OnMouseClick', why doesn't it get the same effect that 'OnMouseOver' and 'OnMouseOut' do?
-Cheers!
batfink
03-28-2004, 05:15 PM
Originally posted by NewbieLearner
thanks, but the first one has no effect, and the other two take to the url on mouse over :confused: And how comes if i place in 'OnMouseClick', why doesn't it get the same effect that 'OnMouseOver' and 'OnMouseOut' do?
-Cheers!
Yep on the first one I forgot to do entire button like you asked just the text only.
onMouseClick...is not an event handler. onClick will do the job.:)
NewbieLearner
03-28-2004, 05:28 PM
:D Thanks m8, got it working now :cool:
-Cheers