Go Back   CodingForums.com > :: Client side development > JavaScript programming

Before you post, read our: Rules & Posting Guidelines

Reply
 
Thread Tools Rate Thread
Enjoy an ad free experience by logging in. Not a member yet? Register.
Old 07-09-2002, 03:54 AM   PM User | #1
jchiff
New to the CF scene

 
Join Date: Jul 2002
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
jchiff is an unknown quantity at this point
Question conflicting javascripts

This poor loser needs sleep, and some help! I have two pretty long scripts - one a drop down menu; the other a Quote of the Day script. Both begin with 'function land(ref, target)' along with some other matching code in the two scripts. Before I start trying to combine them so they don't conflict, is there any quick and dirty advice for me? Other than 'go to bed and start again in the morning?' MANY THANKS.
jchiff is offline   Reply With Quote
Old 07-09-2002, 09:47 AM   PM User | #2
ronaldb66
Senior Coder

 
Join Date: Jun 2002
Location: The Netherlands, Baarn, Ut.
Posts: 4,253
Thanks: 0
Thanked 0 Times in 0 Posts
ronaldb66 is an unknown quantity at this point
If the functions you mentioned are exactly identical you could delete one; otherwise, change the name of one slightly, and don't forget to alter the function calls in the script accordingly!

It would be a great help if you could show the code how you implemented it.

Last note: go to bed and start again in the morning...
__________________
Regards,
Ronald.
ronaldvanderwijden.com
ronaldb66 is offline   Reply With Quote
Old 07-09-2002, 03:52 PM   PM User | #3
Soldier Bob
New Coder

 
Join Date: Jul 2002
Location: USA, East Coast
Posts: 43
Thanks: 0
Thanked 0 Times in 0 Posts
Soldier Bob is an unknown quantity at this point
Cool use the search and replace command in your editor

If you editor doesnt have one, toss it and get a real editor.

append 'menu_' to all the drop down menu function names and append 'day_quote_' to the quote of the day function names.

I am guessing if more then one function is the same, someone forgot what problems this causes? And I am guessing that there would be more scripts out there like this that will cause future confilcts if added.

Appending a unique id to the front of the functions should make them not conflict.

you could use 'a707-4123_' for that matter, but using something that makes more sense to what the functions are used for will help in maintenance. Just make sure that it 'IS' unique.

-S. Bob
Soldier Bob is offline   Reply With Quote
Reply

Bookmarks

Jump To Top of Thread


Thread Tools
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

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT +1. The time now is 01:54 AM.


Advertisement
Log in to turn off these ads.