Jump to content

Archived

This topic is now archived and is closed to further replies.

pgsjoe

javascript and php....don't like each other?

Recommended Posts

so I pulled some script off of DynamicDrive.com and used it on a regular HTML page and it worked awesome. But, once I tried to incorporate PHP into it, all of the sudden "it don't work so good". The script is suppose to float the menu on the page, and as you scroll down, it moves with you. And again it works fine on the regular page, so I'm almost positive it's not the javascript that's messed up.

The box is taking on the CSS attributes (which it should) and parsing the correct information, as well as the rest of the page looking as it should, but the box doesn't float. I know there's a difference between client-side and server-side coding, but I really don't know what to do here. if you know anything, thanks in advance.

So for some reason it won't let me post the code up...keeps giving me a "page cannot be displayed" error. So here's a link to a text version of the code. I've marked off the code that's not working with dashed lines.

http://www.asse.org/gau/help.php

and, if you need to see it. that's here... http://www.asse.org/gau/gauform.php

thank you again in advance. this one is killing me!

Share this post


Link to post
Share on other sites
If this is the script you tried to implement, http://www.dynamicdrive.com/dynamicindex1/staticmenu.htm then I wouldnt' use it altogether.  Not only could I not get it to work on my PHP site but when I went to the aforementioned dynamicdrive site, the menu disappeared and wouldn't come back after scrolling up and down a few times.

Share this post


Link to post
Share on other sites
well I wasn't printing/echoing the script using PHP. I was closing out the PHP tags, entering in the javascript, opening the php tags in the editable region of the code, closing the php tags out and going back into the javascript.

is there something special that has to be done to it? do I have to print the code through PHP?

as for it not working at all, I've been using it for a while on a regular HTML page and it's been holding up okay.

Share this post


Link to post
Share on other sites
it will not let me post the code for some reason. even in code format.

you can view it here....
http://www.dynamicdrive.com/forums/showthread.php?t=13462

or here....
http://www.asse.org/gau/help.php

thanks for looking into it!

Share this post


Link to post
Share on other sites
I'd like to help, but if it's someone else's script, well... it looks like the JS blocks are being correctly interpreted, that's all I can really say at this point.

Share this post


Link to post
Share on other sites
well that's why I know it's not a javascript problem, the script works fine. So I posted it in the PHP help area because I think it's just the way the php is arranged within the script. I just close out the php ?> put the script in, cut into the middle of the script with php <? database retrieval of information ?> then back into the javascript.

Share this post


Link to post
Share on other sites
[quote author=Spencer V link=topic=109569.msg444544#msg444544 date=1159675217]
Are you coding your .php page to use the same doctype as your working .html version?

-SV
[/quote]

Shouldn't have any effect on how it works.

Share this post


Link to post
Share on other sites
Try coding a sample page to be Valid XHTML 1.0 Strict and try that code, I'll bet you change your mind.

pgsjoe--you have exposed sensitive info in your sample page.

-sv

Share this post


Link to post
Share on other sites

×

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.