Today's Posts Follow Us On Twitter! TFL Members on Twitter  
Forum search: Advanced Search  
Navigation
Marketplace
  Members Login:
Lost password?
  Forum Statistics:
Forum Members: 24,254
Total Threads: 80,792
Total Posts: 566,472
There are 1610 users currently browsing (tf).
 
  Our Partners:
 
  TalkFreelance     Design and Development     Programming     Javascript :

Java script and php

Thread title: Java script and php
Closed Thread    
    Thread tools Search this thread Display Modes  
06-08-2008, 04:26 AM
#1
William is offline William
William's Avatar
Status: Junior Member
Join date: Apr 2008
Location: Orlando Florida
Expertise:
Software:
 
Posts: 35
iTrader: 0 / 0%
 

William is on a distinguished road

Send a message via ICQ to William Send a message via MSN to William Send a message via Yahoo to William

  Old  Java script and php

I m wondering if people can use java script on php file? if somebody can help me out!

06-09-2008, 06:45 PM
#2
Liam is offline Liam
Liam's Avatar
Status: Member
Join date: Dec 2007
Location: Liverpool, UK
Expertise:
Software:
 
Posts: 287
iTrader: 0 / 0%
 

Liam is on a distinguished road

Send a message via MSN to Liam

  Old

Originally Posted by William View Post
I m wondering if people can use java script on php file? if somebody can help me out!
same as you would with html.

06-14-2008, 07:08 PM
#3
Swerls is offline Swerls
Status: Junior Member
Join date: Jun 2008
Location:
Expertise:
Software:
 
Posts: 34
iTrader: 0 / 0%
 

Swerls is on a distinguished road

Send a message via AIM to Swerls Send a message via MSN to Swerls Send a message via Yahoo to Swerls Send a message via Skype™ to Swerls

  Old

yea, you just do all the javascrip stuff the same thing as in a html document

07-07-2008, 10:54 PM
#4
Superuser Account is offline Superuser Account
Status: I'm new around here
Join date: Jul 2008
Location:
Expertise:
Software:
 
Posts: 15
iTrader: 0 / 0%
 

Superuser Account is on a distinguished road

  Old

you just have to make sure to execute the new php on your server, otherwise it won't work

for example if you are dynamically changing the content of some "objID," this will not work

inside of your javascript somewhere:
PHP Code:
document.getElementById(objID).innerHTML = "<?php print($somevalue); ?>";
(since the new text never gets to your server, it is just changed on the user's computer)

however this would:
in you html
HTML Code:
<span onclick="yourJSfunction('showvalue.php');">Clicky</span>
in showavlue.php
PHP Code:
<?php print($somevalue); ?>
(since yourJSfunction would actually casue the file showvalue.php to execute on your server and send the results to the user's computer)

so when you print text w/ javascript, it will not compile if you just print it to your html page, you have to have the javascript call the actual php file, so that it runs on the server

07-20-2008, 09:15 PM
#5
infinivert is offline infinivert
infinivert's Avatar
Status: Junior Member
Join date: Jul 2008
Location: Abilene TX
Expertise: Design, PHP, JS, HTML5, CSS3
Software:
 
Posts: 37
iTrader: 0 / 0%
 

infinivert is on a distinguished road

Send a message via AIM to infinivert

  Old

Just understand that the Javascript is being interpreted by your user's computer and acts on the HTML that is generated by your PHP script on the server. In other words, you can't use Javascript to change things at the server level like PHP does. But PHP can output javascript right along with the rest of your HTML.

--Josh

Closed Thread    


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 

  Posting Rules  
Smilies are On
[IMG] code is On
HTML code is Off
Forum Jump:
 
  Contains New Posts Forum Contains New Posts   Contains No New Posts Forum Contains No New Posts   A Closed Forum Forum is Closed