Ravens PHP Scripts: Forums
 

 

View next topic
View previous topic
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript
Author Message
wiz
Involved
Involved



Joined: Oct 09, 2006
Posts: 413
Location: UK

PostPosted: Thu Dec 21, 2006 6:47 pm Reply with quote

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?
 
View user's profile Send private message Visit poster's website AIM Address
hitwalker
Sells PC To Pay For Divorce



Joined:
Posts: 5661

PostPosted: Thu Dec 21, 2006 7:32 pm Reply with quote

have a look in

includes/javascript.php
 
View user's profile Send private message
Gremmie
Former Moderator in Good Standing



Joined: Apr 06, 2006
Posts: 2415
Location: Iowa, USA

PostPosted: Thu Dec 21, 2006 9:14 pm Reply with quote

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 
View user's profile Send private message
wiz







PostPosted: Thu Dec 21, 2006 11:59 pm Reply with quote

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







PostPosted: Fri Dec 22, 2006 12:38 pm Reply with quote

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

PostPosted: Fri Dec 22, 2006 3:16 pm Reply with quote

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/ 
View user's profile Send private message Visit poster's website
wiz







PostPosted: Fri Dec 22, 2006 6:05 pm Reply with quote

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







PostPosted: Fri Dec 22, 2006 7:41 pm Reply with quote

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







PostPosted: Sat Dec 23, 2006 9:40 am Reply with quote

that works a treat!!!

cheers guys
RavensScripts
 
wiz







PostPosted: Sat Dec 23, 2006 9:42 am Reply with quote

or it did!!!

worked for about 5 mins then suddenly stopped
 
Display posts from previous:       
Post new topic   Reply to topic    Ravens PHP Scripts And Web Hosting Forum Index -> JavaScript

View next topic
View previous topic
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
You can attach files in this forum
You can download files in this forum


Powered by phpBB © 2001-2007 phpBB Group
All times are GMT - 6 Hours
 
Forums ©