Author |
Message |
wiz
Involved


Joined: Oct 09, 2006
Posts: 413
Location: UK
|
Posted:
Thu Dec 21, 2006 6:47 pm |
|
Ok heres the question, written by a noob..hopefully generating answers for many noobs.
A lot of blocks use javascript to perform 'animations' or 'scrolls'
So you add your shoutbox for example. Then your clock stops working. So you turn it off, then your clock works fine, but then you add snow for a christmas feel, and your shoutbox stops working.
I saw on Nukecops someone (possibbly Evaders99) post that you could incorporate the .js scripts into your javascript.php
But how? and where?
personally i tried saving the .js for the blocks as seperate files and putting them in the /includes folder, then using an include "includes/shoutbox.js" blah blah at the relevant line in the mainfile script.
Doesnt work
So how do we do it? |
|
|
|
 |
hitwalker
Sells PC To Pay For Divorce

Joined:
Posts: 5661
|
Posted:
Thu Dec 21, 2006 7:32 pm |
|
have a look in
includes/javascript.php |
|
|
|
 |
Gremmie
Former Moderator in Good Standing

Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA
|
Posted:
Thu Dec 21, 2006 9:14 pm |
|
You can write <sc~ript> tags that reference distinct javascript files. Where you might be running into trouble is if the javascript files conflict with each other. Maybe one of your blocks generates an HTML element with a certain ID, and you have identical or similar javascript trying to manipulate that same ID. |
_________________ Only registered users can see links on this board! Get registered or login! - An Event Calendar for PHP-Nuke
Only registered users can see links on this board! Get registered or login! - A Google Maps Nuke Module |
|
|
 |
wiz

|
Posted:
Thu Dec 21, 2006 11:59 pm |
|
yeh thats what foxxed me, i took a look at it but obviously thats written in php and we need javascript. so effectively u are asking one language to use another. |
|
|
|
 |
Gremmie

|
Posted:
Fri Dec 22, 2006 12:38 pm |
|
Well, not sure what you mean. In some Javascript files I've seen, they hardcode HTML elements. You can simply change that and the PHP code so they don't conflict with other scripts on the same page. You can also make PHP code generate Javascript and ensure uniqueness that way. So one language can use another. |
|
|
|
 |
djmaze
Subject Matter Expert

Joined: May 15, 2004
Posts: 727
Location: http://tinyurl.com/5z8dmv
|
Posted:
Fri Dec 22, 2006 3:16 pm |
|
get rid of all those very outdated document.onload and window.onload freaks.
Fix the d*** scripts to addEventListener() and attachEvent() then they all work on the same page. |
_________________ $ mount /dev/spoon /eat/fun auto,overclock 0 1
ERROR: there is no spoon
http://claimedavatar.net/ |
|
|
 |
wiz

|
Posted:
Fri Dec 22, 2006 6:05 pm |
|
djmaze wrote: | get rid of all those very outdated document.onload and window.onload freaks.
Fix the d*** scripts to addEventListener() and attachEvent() then they all work on the same page. |
Interesting..but remember the keyword in the original post.
I am that noob |
|
|
|
 |
djmaze

|
Posted:
Fri Dec 22, 2006 7:41 pm |
|
find inside your scripts
Code:*.onload=functionname
|
replace with
Code:/* xbrowser add event listener */
if (window.addEventListener) {
window.addEventListener('load', functionname, false);
} else if (window.attachEvent) {
window.attachEvent('onload', functionname);
} else {
// alert("Could not attach event to element.");
}
|
that's it |
|
|
|
 |
wiz

|
Posted:
Sat Dec 23, 2006 9:40 am |
|
that works a treat!!!
cheers guys
 |
|
|
|
 |
wiz

|
Posted:
Sat Dec 23, 2006 9:42 am |
|
or it did!!!
worked for about 5 mins then suddenly stopped |
|
|
|
 |
|