NameSilo

Adding chatbox

Spaceship Spaceship
Watch

twizzlers

New Member
Impact
0
Hi, I want to add a chatbox to my site:
http://www.cbox.ws/ ------> basically just generates a html code for you to put on your site.

Is this AJAX? Cuz I tried making a chat_box.php file and it turned out with all these weird symbols. If it's AJAX, can someone kinda point me in the direction of what I would have to do? (I've never done ajax..)

Thanks in advance
 
Last edited:
0
•••
The views expressed on this page by users and staff are their own, not those of NamePros.
AfternicAfternic
It's using Ajax for those other things, so if you want to keep it like that, I guess you'll need Ajax. You could mimic what it's doing in php or javascript, but it wouldn't work exactly the same way. I can't help with ajax, though, I've never worked with it before.
 
0
•••
Simplest method is probably just to include it from the start, but set it to display:none; so it's not visible. When someone clicks the "Chat!" button, you change the display setting on it so it's visible again.

Dan
 
0
•••
Daniel's method is probably the best way to do it without actually messing with AJAX, but it might be helpful to use javascript here.

try doing something like:

Code:
<html>
<head>
<script>
function show(x) {
document.getElementById('divelementname').style.visibility=visible;
}
</script>
</head>
<body>
<div id="chatbox" style="visibility:hidden;">
<?php include("chatbox.php"); ?>
</div>
<input type="button" value="Chat!" onSubmit="show('chatbox')">
</body>
</html>

Or something to that effect.
 
0
•••
So I put that in my layout.php file, but where do I put the code for the chatbox? In the layout place or do I make a separate chatbox.php file?

This is the chatbox code - it's just html right? Do I have to put these php things around it (<?php and ?>)
Code:
<!-- BEGIN CBOX - [url]www.cbox.ws[/url] -->
<div align="center" id="cboxdiv">
<iframe frameborder="0" width="300" height="100" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe><br/>
<iframe frameborder="0" width="300" height="75" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform"></iframe>
</div>
<!-- END CBOX -->
 
0
•••
twizzlers said:
So I put that in my layout.php file, but where do I put the code for the chatbox? In the layout place or do I make a separate chatbox.php file?

This is the chatbox code - it's just html right? Do I have to put these php things around it (<?php and ?>)
Code:
<!-- BEGIN CBOX - [url]www.cbox.ws[/url] -->
<div align="center" id="cboxdiv">
<iframe frameborder="0" width="300" height="100" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe><br/>
<iframe frameborder="0" width="300" height="75" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform"></iframe>
</div>
<!-- END CBOX -->
You can put it in the file or make a separate php file for it, either way, whichever is easier for you.

Yes, it's just an html code. You don't have to put the <?php and ?> around it.

My homepage does that same thing using javascript. I did it a while back just to see if I could.
 
0
•••
why isn't this working?? I put this in my layout.php
Code:
<script>
function show(x) {
document.getElementById('divelementname').style.vi  sibility=visible;
}
</script>
</head>

<body>

<?php include('includes/chat-box.html'); ?>
</div>
<input type="button" value="Chat!" onSubmit="show('chatbox')">

my chat-box.html has this
Code:
<!-- BEGIN CBOX - www.cbox.ws -->
<div align="center" id="cboxdiv"><div class="chat-box">
<iframe frameborder="0" width="300" height="100" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe><br/>
<iframe frameborder="0" width="300" height="75" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform"></iframe>
</div>
<!-- END CBOX -->

But this is what happens:
Code:
ÿþ� �� �� �<�!�-�-� �B�E�G�I�N� �C�B�O�X� �-� �w�w�w�.�c�b�o�x�.�w�s� �-�-�>�� �<�d�i�v� �a�l�i�g�n�=�"�c�e�n�t�e�r�"�
The 'chat!' button shows up, but doesn't do anything when I click it.

So confused!!!
 
0
•••
Code:
<script type='text/javascript'>
function show(x) {
  var el = document.getElementById(x);
  if (!el) return;
  el.style.display='';
}
</script>
</head>

<body>
<?php include('includes/chat-box.html'); ?>
<input type="button" value="Chat!" onclick="show('cboxdiv')">
</body>
</html>

Code:
<div align="center" id="cboxdiv" style='display: none;'>
  <div class="chat-box">
<iframe frameborder="0" width="300" height="100" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=main" marginheight="2" marginwidth="2" scrolling="auto" allowtransparency="yes" name="cboxmain" style="border:#DBE2ED 1px solid;" id="cboxmain"></iframe><br/>
<iframe frameborder="0" width="300" height="75" src="http://www4.cbox.ws/box/?boxid=3522815&boxtag=zacwjc&sec=form" marginheight="2" marginwidth="2" scrolling="no" allowtransparency="yes" name="cboxform" style="border:#DBE2ED 1px solid;border-top:0px" id="cboxform"></iframe>
  </div>
</div>

There were a few things that were wrong, and a few things I changed just by preference, but that should work.


Bruce
 
Last edited:
0
•••
Still just has a bunch of this
Code:
þ� �� �� �<�!�-�-� �B�E�G�I�N� �C�B�O�X� �-� �w�w�w�.�c�b�o�x�.�w�s� �-�-�>�� �<�d�i�v� �a�l�i�g�n�=�"�c�e�n�t�e�r�"�!�-�-� �B�E�G�I�N� �C�B�O�X� �-� �w�w�w�.�c�b�o�x�.�w�s� �-�-�>�� �<�d�i�v� �a�l�i�g�n�=�"�c�e�n�t�e�r�"�

What does ^ even mean?
 
0
•••

We're social

Unstoppable Domains
Domain Recover
NameMaxi - Your Domain Has Buyers
  • The sidebar remains visible by scrolling at a speed relative to the page’s height.
Back