• Forum
  • Doc
  • Screenshots
  • Download
  • Donate
  • Contributors
  • Contact
  • Follow @phpfreechat
  • DEMO
  • Board index ‹ Version 1.x branch ‹ General Support (v1.x)
  • Change font size
  • FAQ
  • Register
  • Login

Having trouble adding function to pfcclient.js

Moderators: OldWolf, re*s.t.a.r.s.*2

Post a reply
6 posts • Page 1 of 1

Postby Erci » Wed May 28, 2008 6:11 pm

Very weird problem:

I have added a very simple function to pfcclient.js right after end of showClass function

Code: Select all
 
test: function()
  {
    alert('hi');
  },

And I added this piece of code to chat.html.tpl.php

Code: Select all
      <div class="pfc_btn">
         <img src="<?php echo $c->getFileUrlFromTheme('images/online-on.gif'); ?>"
             alt="" title=""
             id="pfc_test"
             onclick="pfc.test()" />
      </div>

The button shows up just fine, but when I click on it, I get a javascript error: "pfc.test is not a function". If I set it to one of the existing functions, it works fine. Any idea why I can't seem to successfully add a function to pfcclient.js?? :(
Erci
Member
 
Posts: 10
Joined: Wed May 28, 2008 6:01 pm
Top

Postby Erci » Wed May 28, 2008 6:27 pm

Even weirder... I cut that function out and moved it all the way to the top, right before "initialize" and now it works :) . So I don't really need help now unless you can tell me what I was doing wrong :)
Erci
Member
 
Posts: 10
Joined: Wed May 28, 2008 6:01 pm
Top

Postby cls » Wed May 28, 2008 10:24 pm

At the end of pfcclient.js you should add your code like this:
Code: Select all
,

test: function()
  {
    alert('hi');
  }

Do you see the difference? The comma was misplaced.
I hope this is understandable. My english is not the best - sorry :(
cls
Member
 
Posts: 57
Joined: Sat Aug 18, 2007 10:29 pm
Location: Germany
  • Website
Top

Postby Erci » Thu May 29, 2008 2:38 pm

I know what you mean, but comma was in the right place (I didn't paste whole code in here). I inserted this new function between 2 existing functions. So the comma before the new function was already in place :)
Erci
Member
 
Posts: 10
Joined: Wed May 28, 2008 6:01 pm
Top

Postby cls » Fri May 30, 2008 9:00 am

Oops, I realised that I didn't read your post with adequate attention. :rolleyes:
I tried your code exactly at the same position and it works.
I wouldn't think about this problem anymore. Perhaps this das been only a matter of your browser cache and the old version of the js-file was used.
cls
Member
 
Posts: 57
Joined: Sat Aug 18, 2007 10:29 pm
Location: Germany
  • Website
Top

Postby Erci » Fri May 30, 2008 1:59 pm

Yes, no big deal :) Thanks!
Erci
Member
 
Posts: 10
Joined: Wed May 28, 2008 6:01 pm
Top


Post a reply
6 posts • Page 1 of 1

Return to General Support (v1.x)

Who is online

Users browsing this forum: No registered users and 6 guests

  • Board index
  • The team • Delete all board cookies • All times are UTC + 1 hour
Powered by phpBB® Forum Software © phpBB Group
Sign in
Wrong credentials
Sign up I forgot my password
.
jeu-gratuit.net | more partners
Fork me on GitHub