vForums Support > Programming & Coding :: Code Requests & Support :: > PM checker

PM checker - Posted By Aiken (ionfortuna) on 10th Jan 10 at 12:50am
Global Header:
Code:
 
  1. <script type="text/javascript">
  2. funtion pm(){
  3.  
  4. var pmPost;
  5.  
  6. if(vf_new_pms == 0)
  7. {
  8. pmPost = "<a href="/action/pm"><img src="http://images.virtualforums.co.uk/unread.gif"></a>";
  9. } else {
  10. pmPost ="<a href="/action/pm"><img src="http://images.virtualforums.co.uk/read.gif"></a>";
  11. }
  12.  
  13.  
  14. return pmPost;
  15.  
  16. }
  17. </script>
 


In table:
Code:
 
  1. <script type="text/javascript">
  2. document.write(pm());
  3. </script>
 


This is supposed to determine if there are new PM's or not and show the correct image depending on the result

Re: PM checker - Posted By Michael (wrighty) on 10th Jan 10 at 12:57am
"<a href="/action/pm"><img src="http://images.virtualforums.co.uk/unread.gif"></a>";

That line is the problem. You need to escape double quotes within the double quotes, or simply use:

pmPost = '<a href="/action/pm"><img src="http://images.virtualforums.co.uk/unread.gif"></a>';

And change the other one! {Smile}

Re: PM checker - Posted By Aiken (ionfortuna) on 10th Jan 10 at 1:09am
I can't believe I made that mistake >.<

Edit: I fixed it but it is still not working

Re: PM checker - Posted By Michael (wrighty) on 10th Jan 10 at 1:17am
Post your changed version, and what the outcome is. You have to show the unread messages image if there's 0 new pms! O.o

Re: PM checker - Posted By Aiken (ionfortuna) on 10th Jan 10 at 1:31am
Code:
 
  1. <script type="text/javascript">
  2. funtion pm(){
  3.  
  4. var pmPost;
  5.  
  6. if(vf_new_pms == 0)
  7. {
  8. pmPost = '<a href="/action/pm"><img src="http://images.virtualforums.co.uk/unread.gif"></a>';
  9. } else {
  10. pmPost = '<a href="/action/pm"><img src="http://images.virtualforums.co.uk/read.gif"></a>';
  11. }
  12.  
  13. return pmPost;
  14.  
  15. }
  16. </script>
 


There is no outcome

Re: PM checker - Posted By Michael (wrighty) on 10th Jan 10 at 1:43am
You misspelt the word 'function' you've spelt it funtion. {Wink}

Re: PM checker - Posted By Aiken (ionfortuna) on 10th Jan 10 at 1:53am
Oops

Re: PM checker - Posted By Michael (wrighty) on 10th Jan 10 at 1:54am
Working now? {Smile}

Re: PM checker - Posted By Aiken (ionfortuna) on 10th Jan 10 at 1:55am
Yep