PDA

View Full Version : Javascript question:



entreri
August 12th, 2003, 04:59 PM
Okay, might sound a little confusing... lets say i have this:


<html>
<head>

<script>

function alertBob()
{
alert("Focus on Bob Please");
}


</script>

</head>
<body color="black">


<div id="bob">
hello im bob
</div>

<a href="http://bob.com">Bob's Site</a>

</body>
</html>



How would i make it, so that if i click anywhere on the body, except on a hyper link, or on the div layer "bob", the function alertBob would be executed???

thanks in advance,
entreri



Shoot how do i not make it do html ?

DigitalPimp
August 12th, 2003, 05:49 PM
try using [php] instead of [code]

I was still able to see what you were trying to do. If I get a chance when I get home tonight I'll write u a script.

entreri
August 12th, 2003, 06:02 PM
oo fixed it thanks DP, er the PHP thing anyways, still dunno how to do this =P

DigitalPimp
August 14th, 2003, 04:41 PM
yea, sorry I've just been busy... I'll try tonight... If somebody has a chance they can help also.

λ
August 15th, 2003, 05:12 AM
Couldn't you do it like this:


<html>
<head>

<script>

function alertBob()
{
alert("Focus on Bob Please");
}


</script>

</head>
<body color="black" onclick="javascript:alertBob();">


<div id="bob">
hello im bob
</div>

<a href="http://bob.com">Bob's Site</a>

</body>
</html>