| | |||||
| ||||||||
| Programming PHP, Perl, Ruby on Rails, AJAX, HTML, XHTML, CSS, JavaScript, MySQL and any other coding topics. |
![]() |
| | LinkBack | Thread Tools |
| | THREAD STARTER #1 (permalink) |
| New Member Join Date: Jun 2008
Posts: 7
![]() | Adding chatbox 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
__________________ PM me for a banner.
Last edited by twizzlers; 07-21-2008 at 02:56 PM.
|
| |
| | #2 (permalink) |
| Your face is regfee! Join Date: May 2008 Location: Oregon
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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.
__________________ Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year. My homepage | I miss my dog - Athena |
| |
| | #3 (permalink) |
| Danltn.com Join Date: May 2007 Location: Danltn.com / Nottingham, UK
Posts: 1,201
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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
__________________ |
| |
| | #4 (permalink) |
| Senior Member Join Date: Jul 2005 Location: NJ
Posts: 1,219
![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() ![]() | 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. ????: NamePros.com http://www.namepros.com/programming/489684-adding-chatbox.html 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>
__________________ Hacksar.com - Your source for random computer tips and tricks! MySiteMemberships.com - Keep track of your site registration information! Like my post? Rep is appreciated! |
| |
| | THREAD STARTER #5 (permalink) |
| New Member Join Date: Jun 2008
Posts: 7
![]() | 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 ?>) ????: NamePros.com http://www.namepros.com/showthread.php?t=489684 Code: <!-- BEGIN CBOX - www.cbox.ws --> <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 -->
__________________ PM me for a banner. |
| |
| | #6 (permalink) | ||||
| Your face is regfee! Join Date: May 2008 Location: Oregon
Posts: 1,075
![]() ![]() ![]() ![]() ![]() ![]() ![]() |
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.
__________________ Looking for fantasy hockey owners to begin the new season on ESPN. Deep league with lots of owners and a very high % of keepers (dynasty league). Looking for active owners because this league will continue year after year. My homepage | I miss my dog - Athena | ||||
| |
| | THREAD STARTER #7 (permalink) |
| New Member Join Date: Jun 2008
Posts: 7
![]() | 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')"> ????: NamePros.com http://www.namepros.com/showthread.php?t=489684 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 --> 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�"� So confused!!!
__________________ PM me for a banner. |
| |
| | #8 (permalink) |
| NamePros Member Join Date: Sep 2006
Posts: 99
![]() ![]() | 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> ????: NamePros.com http://www.namepros.com/showthread.php?t=489684 Bruce
Last edited by Bruce_KD; 07-07-2008 at 04:53 PM.
|
| |
| | THREAD STARTER #9 (permalink) |
| New Member Join Date: Jun 2008
Posts: 7
![]() | 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�"�
__________________ PM me for a banner. |
| |