Jump to content

Live chat


poornima

Recommended Posts

Soulstealer, what is this all about?

var obj;
obj = document.getElementById(form_id);
for(i=0;i<obj.length;i++) {
	/*alert(obj[i]);*/
	if (obj[i].tagName == "INPUT") {
		if (obj[i].type == "text") {
			getstr +=obj[i].name+"="+obj[i].value+"&";
		}
		else if(obj[i].type == "hidden") {
			getstr +=obj[i].name+"="+obj[i].value+"&";
		}
	}
	else if(obj[i].tagName == "SELECT") {
		var sel = obj[i];
		getstr +=sel.name +"="+ sel.options[sel.selectedIndex].value + "&";
	}
}

 

If you're getting an element by ID, why would you loop? There should ALWAYS be one entry.

Link to comment
https://forums.phpfreaks.com/topic/156412-live-chat/#findComment-823987
Share on other sites

@Ken2k7

 

Where is your chatroom? I'm not suggesting that Soulstealer's approach is the best, but it's easy to criticize from the bench.

I need a chatroom for show just to say that you shouldn't have more than one HTML element with the same ID on the same page? Well in that case, I'll post links to pages that say that in the future. How's that?

Link to comment
https://forums.phpfreaks.com/topic/156412-live-chat/#findComment-825102
Share on other sites

Not necessary, and I'm not saying you're comment was inaccurate... just lose references like this:

 

Wow, learn xHTML will ya?

 

It puts people on the defensive. A more productive approach would have been something like:

 

Nice job on building this as a proof of concept. I would caution however that using the same ID for multiple elements is not a good practice. You could improve it by...

 

Not interested in arguing with you, just please be careful how you approach people. We want to keep these forums a productive place so that the community grows. That's really all I'm encouraging.

Link to comment
https://forums.phpfreaks.com/topic/156412-live-chat/#findComment-826419
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.