Log in

View Full Version : Javascript Compatability?


Mavrik347
10-27-2008, 02:15 PM
Hi guys, I was told over @ vbulletin.com to post my ticket here as this is the place to ask. So here it is. :)

Hi, I'm having a problem with vB understanding Javascript.

Our site has a roster for the members I made but its shows up wrong... It should work so when you click on a picture of a member the full version opens up in a window as displayed in the third link below.

How it should 'appear'. (Javascript removed) - http://www.britishroguewarriors.com/index.php?pageid=roster

How it does appear. - http://www.britishroguewarriors.com/index.php?pageid=java

How it should work with Javascript. (Source File) - http://www.britishroguewarriors.com/javaroster.html

Do you know how to fix it or is there a work around to make vBulletin let the browser show Javascript properly.

Any help on this would be verrrry appreciated.

Lynne
10-27-2008, 02:26 PM
Why don't you post your page code and template here so we can take a look at it. Please use the code/html/php tags to enclose the code.

Mavrik347
10-27-2008, 04:40 PM
The template is "dark futura". Are you sure you want me to post it all? It would flood the thread :o You can see the code by Right clicking the page and selecting 'View Source' on the third link above (Source File).

Lynne
10-27-2008, 05:05 PM
You might want to read up a bit on including javascript in pages. You should define your script type:
<script type="text/javascript">

And you should enclose all javascript in comment tags:
<!--
javascript
// -->

That probably has nothing to do with your problems, but those were two very obvious things I saw and I'm wondering now about the rest of the code. Did you copy it from somewhere? I'm not a javascript expert, so I can't go through your code for you to see if you wrote it correctly.


Just wondering, but.... you have the list spit out correctly in the first link, right? But the javascript isn't popping up a window, right? And the third link is to an html page which shows the working popup. And the second page is your working page (the one you are trying your code in) which is incorrect. I don't even see where you include the javascript in your second page, I just see it being spit out incorrectly. Try doing what I suggested above and see what the result is.

Mavrik347
10-27-2008, 05:56 PM
The Javascript has been taken out of the first link to show what it should look like.

I have added what you suggested. Yeah it still doesn't show. :/

Lynne
10-27-2008, 06:47 PM
Where are you adding in the javascript in the second link? I don't see it being added anywhere. You should either have it added at the top, like you do the third link, or it should be added as a script like the vb javascript scripts. But, I don't see your's being added anywhere. That is the page I was asking about the source code for - the actual php code for the page that inputs the javascript.

Mavrik347
10-27-2008, 07:19 PM
That's the problem. You see I used the "Add Page" function in vBAdvanced to create the page, I told it to use a HTML file and that third link is the file it's using.

Now for some reason as you just said, on the page it doesn't show and only shows that bit of text "') else writeln(''); writeln('" which is a snippet from the rest of the Java it seems to have ignored. But as you cn see in the source file it's all there.

Lynne
10-27-2008, 07:28 PM
That is an issue you will have to take up with on the vbadvanced forums then. I have no clue how to help using vbadvanced. I just know that that page is not correct for what you want to do. You need to include the javascript in the correct script manner, not from an html page.

Mavrik347
10-27-2008, 10:09 PM
Ohhhh yeah, worked it out. Thank you Lynne for saying something that made me work it out.



Answer: Ok in order for custom Java to work in your pages you need to add the script into the global header. Because this is included in every page you need to make sure your variables are long and preferably complicated so there are no conflicts within the forum.

Admin CP -> Styles & Templates -> Style Manager ->

Expanding all the styles you want it to work in (<< >>) find in each one "headinclude" under "Forum Home Templates".

Make a backup of the old headinclude and add your Javascript to the bottom of headinclude after ALL previous tags have closed.

If your variables are as I suggested then you should encounter no conflicts and all should work fine. :)