I have in javascript a text say I am an idiot

I want to do it. "I am...." and on mouseover it shows up I am an idiot.

How can I do it?

Recommended Answers

All 4 Replies

This what you're looking for?

<html>
<script>
var hideLength=7;
function showText(el){
	el.innerHTML=el.getAttribute("fulltext");
}
function hideText(el){
	if (el.getAttribute("fulltext").length > hideLength){
		el.innerHTML=el.getAttribute("fulltext").substr(0,hideLength-3)+"...";
	}
}
</script>
<body>
<span fulltext="Test this text." onmouseover="showText(this)" onmouseout="hideText(this)">Test...</span>
</body>
</html>

also i dont wanna use span.I am using inputtext, i want to do it inside textbox

So something like this?

<input type="text" value="Test..." title="Test this text." />
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.