Download as doc, pdf, or txt
Download as doc, pdf, or txt
You are on page 1of 4

Layer as static

For Gecko (NS6+, Mozilla, etc) and Opera 6:

.static {
position: fixed;
left: 5px;
top: 5px;
}

for example.

For IE, you're going to need to use a setInterval() and some Javascript - I've recently
experiemented with the expression() property, but the recalculation engine does not seem to
appreciate document.body.scrollLeft and document.body.scrollTop...

for internet explorer:

<span id="staticcombo" style="position:absolute;left:0;top:0;visibility:hidden">


<P> this is static</P>
</span>
<script language="JavaScript1.2">
var combowidth=''
var comboheight=''

function initialize(){
if (document.all){
combowidth=staticcombo.offsetWidth
comboheight=staticcombo.offsetHeight
setInterval("staticit_ie()",50)
staticcombo.style.visibility="visible"
}
else if (document.layers){
combowidth=document.staticcombo.document.width
comboheight=document.staticcombo.document.height
setInterval("staticit_ns()",50)
document.staticcombo.visibility="show"
}
}

function staticit_ie(){
staticcombo.style.pixelLeft=document.body.scrollLeft+document.body.clientWidth-combowidth-30
staticcombo.style.pixelTop=document.body.scrollTop+document.body.clientHeight-comboheight
}

function staticit_ns(){
document.staticcombo.left=pageXOffset+window.innerWidth-combowidth-30
document.staticcombo.top=pageYOffset+window.innerHeight-comboheight
}

window.onload=initialize
</script>

Marquee using an external file for text


<!--[if IE]>

<IE:Download ID="marqueedata" STYLE="behavior:url(#default#download)" />


<marquee id="externalmarquee" direction=up scrollAmount=4
style="width:200px;height:150px;border:1px solid black;padding:3px"
onMouseover="this.scrollAmount=2" onMouseout="this.scrollAmount=4"
src="update.htm">
</marquee>

<script language="JavaScript1.2">

/*
External Data Source Marquee Script (Updated 99/11/02)-
© Dynamic Drive (www.dynamicdrive.com)
For full source code, installation instructions,
100's more DHTML scripts, and Terms Of Use, visit dynamicdrive.com
*/

function downloaddata(){
marqueedata.startDownload(externalmarquee.src,displaydata)
}

function displaydata(data){
externalmarquee.innerHTML=data
}

if (document.all)
window.onload=downloaddata

</script>

<![endif]-->

<form> tag contains <input type= radio> in a loop (ie) if a page contain many questions with radio
buttons as options, and if any question left unchecked it should alert me a dialog box saying not
clicked. If there is only one question in a page by wrinting a javascript code, it can be checked.

:rolleyes:

What javascript code should be implemented as soon as the submit button of the page is clicked,
checking all the radio buttons be clicked and if one radio button is unchecked pop a dialog box.
I am sure there are lots of ways to accomplish this but something along these lines ought to do it:

<script type="text/javascript">
<!--//
function radioCheck(){
var temp=bad="", ok=0;
for(var i=0; i<document.f.elements.length; i++){
if(document.f.elements[i].type=="radio"){
if(temp!=document.f.elements[i].name || i==document.f.elements.length-2){
if(ok==0 && temp!="") bad +=" "+temp+"\n";
temp=document.f.elements[i].name;
ok=0;
}
ok+=document.f.elements[i].checked;
}
}

if (bad!=""){
alert("Be sure to choose one of the following:\n\n"+bad);
return false;
}
else{
return true;
}

}
//-->
</script>

<form name="f" onsubmit="return radioCheck()">


gender:
<input type="radio" name="gender" value="male"> male
<input type="radio" name="gender" value="female"> female
<br />
I like pizza:
<input type="radio" name="pizza" value="true"> true
<input type="radio" name="pizza" value="false"> false
<br />
I like chocolate:
<input type="radio" name="chocolate" value="true"> true
<input type="radio" name="chocolate" value="false"> false
<br />
<input type="submit" value="submit">
</form>

Restrict Printing and Text Copy


Here is a no text select script:

<script language="JavaScript1.2">

//Disable select-text script (IE4+, NS6+)

function disableselect(e){
return false
}

function reEnable(){
return true
}

//if IE4+
document.onselectstart=new Function ("return false")

//if NS6
if (window.sidebar){
document.onmousedown=disableselect
document.onclick=reEnable
}
</script>

And this is a No right Click script:

<script language=JavaScript>
<!--
//Disable right click script

var message="";
///////////////////////////////////
function clickIE() {if (document.all) {(message);return false;}}
function clickNS(e) {if
(document.layers||(document.getElementById&&!document.all)) {
if (e.which==2||e.which==3) {(message);return false;}}}
if (document.layers)
{document.captureEvents(Event.MOUSEDOWN);document.onmousedown=clickNS;}
else{document.onmouseup=clickNS;document.oncontextmenu=clickIE;}

document.oncontextmenu=new Function("return false")


// -->
</script>

try those out

Among the other techniques you can use:

<html>
<head>
<title>Testing</title>
<style>
@media print { body {visibility: hidden;}}
</style>
<script>
</script>
</head>
<body>
<h1>Test Page</h1>
<form>
</form>
<script>
</script>
</body>
</html>

Try printing that page :D . If you've got enough things on your page that should prevent printing
then that fact alone should give you a lot of ammunition to come back on someone who carries up
a copy of the page regardless of whether they managed to alter any of the content or not.

You might also like