PHP Web Host - Quality Web Hosting For All PHP Applications Sign up for PayPal and start accepting credit card payments instantly
  Login or Register
 • Home • Downloads • Your Account • Forums • 

View next topic
View previous topic


Google
 
Web RavenPHPScripts (This Site)
Post new topic   Reply to topic
Author Message
wiz
Client


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

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

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
persona_non_grata



Joined:
Posts: 0

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

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: 2401
Location: Iowa, USA

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

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


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

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

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.
View user's profile Send private message Visit poster's website AIM Address
Gremmie
Former Moderator in Good Standing


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

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

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.
View user's profile Send private message
djmaze
Subject Matter Expert


Joined: May 15, 2004
Posts: 557
Location: http://tinyurl.com/5z8dmv

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

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


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

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

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
View user's profile Send private message Visit poster's website AIM Address
djmaze
Subject Matter Expert


Joined: May 15, 2004
Posts: 557
Location: http://tinyurl.com/5z8dmv

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

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


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

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

that works a treat!!!

cheers guys
RavensScripts
View user's profile Send private message Visit poster's website AIM Address
wiz
Client


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

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

or it did!!!

worked for about 5 mins then suddenly stopped
View user's profile Send private message Visit poster's website AIM Address
Display posts from previous:       
Post new topic   Reply to topic

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
Forums ©
 

All logos and trademarks in this site are property of their respective owner.
The comments are property of their posters, all the rest © 2002-2008 by Raven
Proud to be listed at Lobo Links Web Directory

You can syndicate our news using the file xml

CSE HTML Validator Helped Clean up This Page! [Valid RSS] valid RSS 2.0 Valid robots.txt Stop Spam Harvesters, Join Project Honey Pot

Website engines core code is © copyright by PHP-Nuke but has been heavily patched and modified by myself and others.
PHP-Nuke is a free software released under the GNU/GPL.


:: fisubice phpbb2 style by Daz :: PHP-Nuke theme by www.nukemods.com ::

:: fisubice Theme Recoded To 100% W3C CSS & HTML 4.01 Transitional Compliance by Raven and 64bitguy ::

:: W3C CSS Compliance Validation :: W3C HTML 4.01 Transitional Compliance Validation ::

zerosum