Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations biv343 on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

hide/reveal alternating characters

Status
Not open for further replies.

Microbe

Programmer
Oct 16, 2000
607
AU
Hey folks,

I had a sneaky piece of spam today that read "D e a r e B a y u s e r" etc etc.

The trick was that in the gaps they had put random characters that were the same colour as the background. I guess the plan was to bayesian filters it would look like a meaningles string of text but would read properly to humans. Good news is that spambayes (spambayes.sourceforge.net) caught it :eek:)

I would like to use this example on my blog and I am sure that using CSS I can have some of the letters hidden and then on mouseover have it reveal them, mouseout and they vanish again.

I am kind of 1/2 way there in that I can get a single block of text to appear onMouseOver, but if I wanted to reveal all the hidden letters in several paragraphs at once, what would be the best way to do this?

Thanks in advance...and I HIGHLY reccomend spambayes

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
well you might have to play with spacing but have 2 layers one layers hold 1 set of letters and the other holds the rest

Listen All I ask is that You close out a Post You Started!!!!
 
sorry that was kinda half assed -- but you will also have to play with the layers z-index as well -- that would be the easiest way i could think of it -- maybe an array could work but i dont know how those would work.

Listen All I ask is that You close out a Post You Started!!!!
 
Not sure if this is what you were after:
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
	<title>Hidden Text...</title>
<style>
.nonprop {
	font-family: courier;
	height: 20px;
	background-color: #cccccc;
}
</style>
<script type="text/javascript">
var theTxt=new Array(2);
theTxt[0]="This is the first sentence in the test";
theTxt[1]="But I'm not sure if this was a solution";
function writeMe(obj,num) {
	msg="";
	for(var x=0;x<theTxt[num].length;x++) msg+=theTxt[num].charAt(x)+"&nbsp;";
	if(num) msg="&nbsp;"+msg;
	obj.innerHTML=msg;
}
</script>
</head>
<body>
<div class="nonprop" id="thediv" onmouseover="writeMe(this,1);" onmouseout="writeMe(this,0);"></div>
</body>
</html>

Just enjoyed having a play. [thumbsup2]

Pete.


Web Developer &amp; Aptrix / Lotus Workplace Web Content Management (LWWCM) Specialist
w: e: Pete.Raleigh(at)lclimited.co.uk
 
Yeah, that will do the job though a bit of a kludge.

I will put the "visible text" in one of the strings and the complete text, including the hidden stuff in the other.

Thanks everyone for you sugestions.

Steve Davis
hey.you@hahaha.com.au

Me? I can't even spell ASP!
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top