Jump to content


Javascript Variables


  • You cannot reply to this topic
No replies to this topic

#1 .CJ

    Young Padawan

  • Members
  • Pip
  • 114 posts
  • Gender:Male
  • Location:Leeds, UK

Posted 31 August 2007 - 10:44 AM

Aye up.

Here's some code:
<!--PM Notification Box, showed when a new PM is found-->
   {if $pm ge 1}
   <div id="pm_box" class="pm-notify">
	 PM BOX
   </div>
   <script type="text/javascript">
   {literal}
	 // Get user's screen width and height
	 var dimensions = $('pm_box').getDimensions();
	 var w = (screen.width - dimensions.width) / 2;
	 var h = (screen.height - dimensions.height) / 2;
	 
	 $('pm_box').setStyle({width: '450px', height: '300px'});
   {/literal}
   </script>
   {/if}

For anyone who doesn't understand the different syntax, I'm using Smarty and Prototype.

I want to add the value of the variables w and h into $('pm_box').setStyle({width: '450px', height: '300px', top: H VALUE, left: W VALUE}); but the top and left attributes do not show. I know there is a value to both the W and H var's, just not sure how to display it in that function.

Any help would be appriciated.

- Chris.





1 user(s) are reading this topic

0 members, 1 guests, 0 anonymous users