Click to See Complete Forum and Search --> : tool tips for text box?


lting
06-02-2004, 01:41 AM
i have one text box for users to filling the date...

i wnat to have tool tips when user move their mouse on the text box it will show dd/mm/yyyy ...

how can i do that?

Pittimann
06-02-2004, 01:44 AM
Hi!

<input type="text" title="dd/mm/yyyy">

Cheers - Pit

coothead
06-02-2004, 03:33 AM
Hi there lting,

I have a sneaky suspicion that you
require a wee bit more than Pittimann's
excellent suggestion :D

If that is the case then try this

<script type="text/javascript">
//<![CDATA[

function setTitle(el) {
var today=new Date();
var day=today.toDateString();
el.setAttribute('title',day);
}
//]]>
</script>

<form action="">
<input type="text" onmouseover="setTitle(this)"/>
</form>


coothead

Pittimann
06-02-2004, 06:11 AM
Hey coothead!

I am 100% convinced that lting has been talking about the correct format. Your example shows the current date but like this:

Wed Jun 2 2004

If (and I believe that), lting wants the users to enter the date in the format required, your code would have better looked similar to this:<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Untitled</title>
</head>
<body>
<script language="JavaScript" type="text/javascript">
<!--
function setTitle(el) {
var today=new Date();
var day=today.getDate();
var month=today.getMonth()+1;
var year=today.getFullYear();
day=(day>9)?day:'0'+day;
month=(month>9)?month:'0'+month;
el.setAttribute('title',day+'/'+month+'/'+year);
}
//-->
</script>
<form action="">
<input type="text" onmouseover="setTitle(this)"/>
</form>
</body>
</html>Cheers - Pit

coothead
06-02-2004, 07:50 AM
Hi there Pittimann,

Between the two us, I think that we have
just about got this little problem solved :D

coothead

Pittimann
06-02-2004, 07:53 AM
Hi there coothead,

Exactly!

Cheers - Pit