Can someone help me with making code that for example after 5 seconds will show hidden text
thanks
its FBML but i think that this code must be in FBJSIs this just in a HTML page?
I like your avatar man.
Is that you?
http://fatboy.me.uk/delay
thanks alotLOL, I wish - nah, he is Frank out of Shameless, one of the best TV shows....
Anyway - to the OP, if you visit:------------------you should see what you are after. Its not my own code, its bits I have 'borrowed' from other websites over the years.
If its what you want, just view the source
To change the delay, find the 5000 in the source and change it to what you want - 5000 equals 5 seconds.
Never played with FB code sorry - hopefully you can get my code to work in there
Cheers![]()
<html>
<head>
<title>Hidden text will show 5 seconds after page load</title>
<script type="text/javascript">
<!--
function ShowHidden(id) {
obj = document.getElementsByTagName("div");
setTimeout("ShowHidden('HiddenDiv')",5000);
obj[id].style.visibility = 'visible';
}
onload = ShowHidden
//-->
</script>
<style type="text/css">
<!--
#HiddenDiv
{
visibility:hidden;
width:100px;
height:100px;
position:absolute;
left:200px;
top:20px;
border:1px;
}
-->
</style>
</head>
<body>
<div id="HiddenDiv">Here is the hidden text you want to show</div>
</body>
</html>
edit- I see fatboy gave you an answer while I was making my reply. So that gives you two possible javascript solutions. You just need to figure how to adapt one to work in fbml.
If you can get it to work in the fbml code tester then you should be able to get it working on the live page too. It's probably just some kind of stupid formatting problem like a line feed messing it up or something. Things like that can be frustrating as hell when dealing with php scripts. Maybe fbml has similar quirks.thanks alot
i have problem,when i put code on fbml code tester code work but when i try on face then code dont show hidden content
"In profile boxes, inline scripts are deferred until the first "active" event is triggered by a user. An active event is considered either onfocus, onclick, onmousedown, and so forth. Basically anything that requires a mouse click is an "active" event. On a canvas page, however, this example works just fine."
If that doesn't help and someone good with fbml doesn't come in the thread then you'll just need to look through the fbml faq pages.the wiki page mentions that code should be setup like this: <script> <!-- //--> </script> try inserting your FBJS within these script tags like so: <script> <!-- document.getElementById('button1').setStyle({display: 'none'}); //--> </script>
http://stackoverflow.com/questions/1866731/can-javascript-be-used-in-static-fbml-under-pages-tab
im trying to convert but i dont know what im doing wrong,when i check code on site for test fbml code all works normally but when i put that code on my fan page then code dont work
setTimeout(function() { your_function_todisplay_text(); },1000);
<style type="text/css">
<!--
#HiddenDiv
{
visibility:hidden;
}
-->
</style>
<a href="#" onclick="setTimeout(show_hidden,5000);">Show Hidden!</a>
<div id="HiddenDiv">Here is the hidden text you want to show</div>
<script>
<!--
function show_hidden() {
document.getElementById('HiddenDiv').setStyle('visibility', 'visible');
}
//-->
</script>
<a class="UIButton UIButton_Gray UIActionButton" clicktoshow="{[B]id[/B]}"><span class="UIButton_Text">Next Step</a>
<div id="{[B]id[/B]}" style="display:none">yeaa baby</div>
thanks alot for this code,that is what im looking forIn addition to script execution being delayed untill an event is triggered by a user, manipulation of DOM objects in FBJS (Facebook Javascript) is handled differently as well. You will want to use the fbjs setter 'setStyle'. Basically this is the grey's code code keeping in mind with what php5 mentioned and using the proper fbjs setter.
Code:<style type="text/css"> <!-- #HiddenDiv { visibility:hidden; } --> </style> <a href="#" onclick="setTimeout(show_hidden,5000);">Show Hidden!</a> <div id="HiddenDiv">Here is the hidden text you want to show</div> <script> <!-- function show_hidden() { document.getElementById('HiddenDiv').setStyle('visibility', 'visible'); } //--> </script>
one question
can this code be modified that when i press button it redirect me to some other site in new tab and also show hidden content below button?
or button can be used only for one function?
Code:<a class="UIButton UIButton_Gray UIActionButton" clicktoshow="{[B]id[/B]}"><span class="UIButton_Text">Next Step</a> <div id="{[B]id[/B]}" style="display:none">yeaa baby</div>
<a href="http://www.google.com/" target="_blank" onclick="setTimeout(show_hidden,5000);">Show hidden and open in new tab!</a>
Thanks alot for your helpYour welcome.
No I don't belive you can use the clicktoshow attribute along with an href like that.
You can do something similar with the code I posted above however.
............