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 Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Body Tag 2

Status
Not open for further replies.

livezone

MIS
Jan 17, 2003
81
CA
Hi,

My whole project <body> tag contains this

<code>
<body onload="start();" onmousemove="start();" onclick="start();" onkeydown="start();">

------

</code>

One way to type
<code>
onload="start();" onmousemove="start();" onclick="start();" onkeydown="start();"
</code>
this in all pages. Is there any other way in CSS to define the body tag with all those attributes in CSS
<code>
body
{
onload="start();" onmousemove="start();" onclick="start();" onkeydown="start();"

}
</code>
Will this work?
 
CSS? CSS is for styles, not for calling JS functions.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
But if you do have a js file included in all your pages, you could add
Code:
document.body.onload = start;
document.body.onmousemove = start;
document.body.onclick = start;
document.body.onkeydown = start;
something like that to the js include.

hope that helps

"Insane people are always sure that they are fine. It is only the sane people who are willing to admit that they are crazy." - Nora Ephron
 
me likey.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
I am getting the following
document.body is null or not an object

I am using IE 6.0 with ASP.NET?

Here is how I am accessing it

<code>
<script language="JavaScript" type="text/javascript" src="timeout.js"></script>

timeout.js
==========

var session_timeout = 1000 * 60 * 2;
var reloadpage = "../home.html";
var timeout = null;

function start()
{

if (timeout)
clearTimeout(timeout);
timeout = setTimeout("location.replace('" + reloadpage + "');", session_timeout);
}

document.body.onload = start();
document.body.onmousemove = start();
document.body.onclick = start();
document.body.onkeydown = start();
</code>
 
I would just do this:

Code:
onload = start();
mousemove = start();
onclick = start();
onkeydown = start();

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
If that doesn't work, include that JS file at the bottom of your page, rather than at the top.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Not working both ways. Giving error "Not Implemented
 
whoa, where did the ()'s come from. Should just be

Code:
onload=start;

as Dookie said. Sorry, mine was because I copied-pasted yours.

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
(same for all, I just showed onload as an example)

*cLFlaVA
----------------------------
[tt]insert funny quotation here.[/tt]
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top