...

View Full Version : Can you help me please....



Scoot
06-22-2012, 12:20 PM
Hi Guy's, Im looking for a little help if you dont mind.

I know very little about website code but getting taught very slowly......

I have a piece of script that I would need to place on my website to conform to European law.

What I need the code to do is hide the item after a set amount of time IE: 6 or 10 seconds.

And to be in front of other items on my website, as it hides part of it behide other things.

The code I have is below:

<link rel="stylesheet" type="text/css" href="http://www.thehostingfolks.com/cookiemain.css"/>

<script type="text/javascript" src="http://www.thehostingfolks.com/support-opt-in.js"></script>

<script type="text/javascript" src="http://www.thehostingfolks.com/require-opt-in.js" read_more="http://www.mywebsite.co.uk/page/privacy_policy/"></script>

Please can anyone help crack this for me.

Thank you.

Philip M
06-22-2012, 04:30 PM
You need to place the message within a <div> with id (say) "mydiv" with style="display:block". Then


<script type = "text/javascript">
window.onload ="function(){setTimeout(hideTheDiv,6000)"}; // 6000 milliseconds = 6 seconds
function hideTheDiv() {
document.getElementById("mydiv").style.display="none";
}

</script>

It is important not to have more than one onload statement in the page so you need to check your other code to ensure that is so. You may need to do something like to fire all your functions in one statement:-


<script type="text/javascript">
window.onload = function() {
functionOne();
functionTwo();
}
</script>


Quizmaster: Which national park is situated mostly in Derbyshire?
Contestant: The Yorkshire Dales



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum