gareth2 Posted December 21, 2006 Share Posted December 21, 2006 could some one tell me what is wrong with this.[code]<p align=center id=message_0 style=visibility:hidden>You attack $stat1[user] for $stat[att].</p><script>var message_0 = document.getElementById(message_0);window.setTimeout(message_0.style.visibility='visible', 100);</script>[/code] Link to comment https://forums.phpfreaks.com/topic/31514-settimeout-syntax-problem/ Share on other sites More sharing options...
darrin365 Posted December 21, 2006 Share Posted December 21, 2006 I am by no means and expert, so take this with a grain of salt, but on the HTML side of things "align" is a deprecated attribute with regard to the <p> tags. You also should have id="message_0" and style="visibility:hidden" (if your intention is for the latter to be a CSS style). Link to comment https://forums.phpfreaks.com/topic/31514-settimeout-syntax-problem/#findComment-145985 Share on other sites More sharing options...
obsidian Posted December 21, 2006 Share Posted December 21, 2006 darrin365 is on the right track. Your main issue is that within your getElementById() function call, you must have the id name within quotes. In addition, you really need to clean up your markup, or you'll have all sorts of issues in the long run. Also, your setTimeout function accepts a [b]string[/b] as the first parameter, not straight code. So, you need to either write a function that will show what you're after, and call that function, or you need to encapsulate your script to run within quotes:[code]<p align="center" id="message_0 " style="visibility:hidden;">You attack $stat1[user] for $stat[att].</p><script type="text/javascript">function showDiv(id) { var myDiv = document.getElementById(id); myDiv.style.visibility = 'visible';}window.setTimeout('showDiv("message_0")', 100);</script>[/code]Good luck. Link to comment https://forums.phpfreaks.com/topic/31514-settimeout-syntax-problem/#findComment-145989 Share on other sites More sharing options...
artacus Posted December 21, 2006 Share Posted December 21, 2006 PS: Please use descriptive titles in the future. Link to comment https://forums.phpfreaks.com/topic/31514-settimeout-syntax-problem/#findComment-146058 Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.