PDA

View Full Version : Disabling Enter BUtton on the site


DarkLegacy
06-20-2003, 08:39 PM
Heres my site, how can I disable enter so they cant speed through it, thanks.


<SCRIPT LANGUAGE="JavaScript">

<!-- ;

alert("Welcome to the Clan SA- home site.");
alert("Hope you enjoy your stay!");
alert("Standby.....");
alert("Please visit the forum.");
alert("Dont forget to vote for us on the top 10 clans");
alert("Please remember not to spam on the forums.");
alert("Please sign in.");
alert("Good Day, Site loading...");
// end hide -->

</SCRIPT>
</head>


Edit: Is it possible to change Ok to any other thing u want on the button?

arnyinc
06-20-2003, 08:51 PM
Unfortunately I don't believe either of those things are possible.

Also, I would never come to your site more than once if I got bombarded by alert boxes.

DarkLegacy
06-20-2003, 08:59 PM
:( thats the point its a trick site. Comeon u must beable to block enter, not for the whoile computer but when there in that webpage. Like on action cancel or whatever lol.

DarkLegacy
06-20-2003, 09:20 PM
anyone... bump

Ben@WEBProp
06-20-2003, 09:30 PM
Just make a Flash presentation with a no "skip intro" option on...

Although Flash is super expensive for such a task, and really hard to learn, it is the only thing I could think of...

Oh ya, stop bumping this....please?

I hope that helped!

-Ben

shlagish
06-20-2003, 09:31 PM
I think they are both possible:

To disable the Enter button:

<script type="text/javascript">
<!--

var ns4=document.layers?1:0
var ie4=document.all&&navigator.userAgent.indexOf("Opera")==-1
var ns6=document.getElementById&&!document.all?1:0

if (ns4)
document.captureEvents(Event.KEYPRESS)
function menuengine(e){
if (ns4||ns6){
if (e.which==#)
alert('You may not use the enter key')
}
else if (ie4){
if (event.keyCode==#)
alert('You may not use the enter key')
}
}
document.onkeypress=menuengine
</script>
Just replace # by the Enter key's unicode (I don't know it)


As for changing the ok to something else, you could try making a custom alert box...



function showHide(layerid){
if (document.getElementById(layerid).style.visibility != "hidden"){
document.getElementById(layerid).style.visibility = "hidden";
}
else{
document.getElementById(layerid).style.visibility = "visible";
}
}

Then, onLoad="showHide('box1')"

the box is like this:
<DIV id="box1" style="position:absolute;left:50;top:150;width:250;color:#FFFFFF;border-top:2px solid #ffffff; border-left:2px solid #ffffff; border-right:2px solid #808080; border-bottom:2px solid #808080; background:#d8cfc8;visibility:hidden;text-align:center">

<div style="height:18;font-size:12;text-align:left;filter:progid:DXImageTransform.Microsoft.Gradient(GradientType=1, StartColorStr='#FF005500', EndColorStr='#FF00ff00'')">Your Site Name</div>

<P><center><font color="black" size=2>Your Message</font></center>

<form>
<span style="position:relative;left:0;top:10;width:75;height:22;border:1px groove #000000">
<input type=button value="OK" style="width:74;height:20;font-size:10;border:1px outset #ffffff;" onclick="showHide('box1')">
</span>
</form>
</DIV>
go here (http://www.huntingground.freeserve.co.uk/main/mainfram.htm?../scripts/snav.htm&2), click on 'Site Map.', click on 'Alert Box' for more details

shlagish
06-20-2003, 09:35 PM
btw, it probably wont work, but it might, I didn't test it, and there might be some tweaking to do