JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old July 30th, 2001, 11:19 PM
phreq phreq is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: New Zealand
Posts: 167 phreq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 3 sec
Reputation Power: 8
Question drowning in javascript...

Hi guys,

I've just downloaded this php-based chat program. However it's giving me some javascript errors and, since I'm trying to understand how the whole enchilada works, I took a peek at the source code.

It's kind of complicated... anyone got any bright ideas on even what the constructs used here mean? For example:

function sendMessage(name) {
if (document.all) {
top.wIn.document.all['form1'].txt.value="/msg "+name+' ';
} else {
top.wIn.document.form1.txt.value="/msg "+name+' ';
}
setFocus();
}

Is this javascript? (it's not specified, but it gave me a javascript error, so I'm assuming...)

Here's some more of the enfant terrible:

<script>
function doSubmit() {
if (document.all) {
top.wSend.document.all['form2'].txt.value=escape(document.all['form1'].txt.value);
top.wSend.document.all['form2'].submit();
document.all['form1'].txt.value='';
} else {
top.wSend.document.form2.txt.value=escape(document.form1.txt.value);
top.wSend.document.form2.submit();
document.form1.txt.value='';
}

return false;
}

function setFocus() {
if (document.all) {
document.all['form1'].txt.focus();
} else {
document.form1.txt.focus();
}
}

</script>

What can I say?

Any help appreciated!

Jen

Reply With Quote
  #2  
Old July 31st, 2001, 12:19 AM
szarecor szarecor is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Apr 2001
Location: New York
Posts: 122 szarecor User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 8
Jen:

Without seeing the "whole enchilada" and knowing what kind of errors are being generated, I don't know how much help I can offer. I've included a few comments that might help:

Yes, it's Javascript.

The code is expecting to operate in a html frameset, with two frames named "wIn" and "wSend".

"wIn" should contain a form named "form1" and "wSend" should contain a form named "form2".

Both forms have text fields named "txt".

I don't know what else to tell you. Let me know what the error messages are (and when they occur) and send along the relevant code, if you need more help.

Good luck.

Reply With Quote
  #3  
Old July 31st, 2001, 09:22 AM
DJdrenaline DJdrenaline is offline
Contributing User
Dev Shed Novice (500 - 999 posts)
 
Join Date: Jun 2001
Location: Toronto, Ontario, Canada
Posts: 631 DJdrenaline User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 6 m 4 sec
Reputation Power: 8
Without seeing the errors, the most likely problem is that you dont have forms named form1 and form2, and an input in each named txt.

Reply With Quote
  #4  
Old July 31st, 2001, 05:05 PM
phreq phreq is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Mar 2001
Location: New Zealand
Posts: 167 phreq User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 9 m 3 sec
Reputation Power: 8
thanks...

Thanks for the help...

For some reason, when I changed the name of the database the php was trying to contact, the javascript errors went away. Now I'm REALLY confused! how does a database connection error disrupt the client-side script? The php wasn't writing any elements to the page or anything, it was just doing an insert AFTER all the javascript etc had run.

Very strange!

Anyway, thanks for the deconstructs, I always freak when I see these big blocks of script!

Jen

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > drowning in javascript...


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 5 hosted by Hostway
Stay green...Green IT