PDA

View Full Version : Require javascript for online help chat box



enkelsolutions
10-22-2008, 05:00 PM
Hi All,

I require javascript for a online help chat box, moving across a page from left to right or vice versa as soon as site is opened through Url.

This chat box should have an option to close the box if not required..

I would request you to help me the earliest , as i'm in need to implement the same..Thanking you all in advance.


Regards,
Ramya

Nile
10-22-2008, 09:00 PM
We'd need to see your code for we have no clue how your box is being called. If it is an element, you would use something like this.


<script type="text/javascript">
var close = function(el){
el.style.display = "none";
}
</script>

Then to close it you could do something like this:


<button onClick="close(document.getElementById('myDiv'));>X</button>

magicyte
10-22-2008, 10:34 PM
It be better you use <input type="button"> instead of <button>. Your first suggestion would not be save nor should it work. It also be best you use a semi-colon at the end of a js variable. The correct syntax is:


<script type="text/javascript">
<!--
var close = function (el){
document.getElementById(el).style.display = "none";
};
//-->
</script>

-magicyte

rangana
10-23-2008, 12:34 AM
magicyte, your comment on JS is erroneous:


<script type="text/javascript">
<!--
var close = function (el){
document.getElementById(el).style.display = "none";
};
//-->
</script>

For further reading:
http://www.linuxtopia.org/online_books/javascript_guides/javascript_faq/hidingjs.htm

Nile
10-23-2008, 02:30 AM
Magic, if I'm getting the element when calling it, I shouldn't not then neeed to call it again.

Twey
10-23-2008, 07:19 AM
However, the <!-- and --> there generally shouldn't be used, since they will hide the script entirely from the browser under XHTML. Every browser that can't execute Javascript at least knows enough to ignore it, since about a decade ago. magicyte, you should get into the habit of indenting your code properly.

As for the rest of your chat box, Ramya, it depends on what server-side technologies you have at your disposal. This cannot be implemented entirely client-side: there must be at least a small server-side component.

enkelsolutions
10-23-2008, 07:51 AM
Hi All,


Thanks for your reply... I have no experience in coding except for doing minor modifications...
I have an example site which have the chat box, how I prefer..
No idea if i could post that link here....
I have such an idea to implement for a website.
If i could get in touch through personal id's for further discussion, it would be helpful.

Aswell need a help for serverside scripting too.

Thanks
Ramya

Mike H.
10-23-2008, 11:41 AM
See, my code here:

http://www.freewarefiles.com/program_5_53_23396.html

Easy AJAX / PHP Chat.