Jump to content


Photo

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


  • Please log in to reply
11 replies to this topic

#1 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 26 September 2006 - 04:23 PM

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!



#2 steveclondon

steveclondon
  • Members
  • PipPipPip
  • Advanced Member
  • 161 posts

Posted 26 September 2006 - 04:54 PM

They do but remember if you are going to echo or print javascript you will need to escape the quotes \'

#3 thepip3r

thepip3r
  • Members
  • PipPipPip
  • Advanced Member
  • 289 posts

Posted 26 September 2006 - 05:02 PM

If this is the script you tried to implement, http://www.dynamicdr.../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.

#4 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 26 September 2006 - 05:20 PM

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.

#5 kenrbnsn

kenrbnsn
  • Staff Alumni
  • Advanced Member
  • 8,235 posts
  • LocationHillsborough, NJ, USA

Posted 26 September 2006 - 07:29 PM

Can you post some of your code here?

Ken

#6 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 26 September 2006 - 08:03 PM

it will not let me post the code for some reason. even in code format.

you can view it here....
http://www.dynamicdr...ead.php?t=13462

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

thanks for looking into it!

#7 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 28 September 2006 - 10:35 PM

can anyone get my back on this one?

#8 fenway

fenway
  • Staff Alumni
  • MySQL Si-Fu / PHP Resident Alien
  • 16,199 posts
  • LocationToronto, ON

Posted 29 September 2006 - 03:01 AM

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.
Seriously... if people don't start reading this before posting, I'm going to consider not answering at all.

#9 pgsjoe

pgsjoe
  • Members
  • PipPipPip
  • Advanced Member
  • 34 posts

Posted 29 September 2006 - 02:58 PM

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.

#10 Spencer V

Spencer V
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 01 October 2006 - 04:00 AM

Are you coding your .php page to use the same doctype as your working .html version?

-SV

#11 Daniel0

Daniel0
  • Staff Alumni
  • Advanced Member
  • 11,956 posts

Posted 01 October 2006 - 05:38 PM

Are you coding your .php page to use the same doctype as your working .html version?

-SV


Shouldn't have any effect on how it works.

#12 Spencer V

Spencer V
  • New Members
  • Pip
  • Newbie
  • 3 posts

Posted 01 October 2006 - 09:27 PM

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




0 user(s) are reading this topic

0 members, 0 guests, 0 anonymous users