Solved

php include of javascript file (in php) works, but javascript include does not show javascript effects

Posted on 2013-06-03
3
537 Views
Last Modified: 2013-06-03
<?php include 'js/members.php'; ?>

<script src='js/members.js';
i do same file as .js
I can see the file in firebug

but none of js features are implemented

  <script type='text/javascript'>
  
  // Browser safe opacity handling function
  
  // membership requests
  
  if (document.all||document.getElementById){
  document.write('<style id="tmpStyle" type="text/css">#pic {-moz-opacity:0.00;filter:alpha(opacity=0);opacity:0;-khtml-opacity:0;}<\/style>')
  var objG, degree=fadeAssist=0;
  if (document.all&&typeof document.documentElement!=='undefined')
  document.write('<!--[if GTE IE 5]><script type="text/javascript">fadeAssist=function (obj, degree){try {obj.filters.alpha.opacity=degree}catch(e){obj.style.filter="alpha(opacity="+degree+")"}}<'+'\/'+'script><![endif]-->')
  }
  
  function fadepic(obj){
  objG=obj
  if (!document.getElementById&&!document.all)
  return;
  var tS=document.all? document.all['tmpStyle'] : document.getElementById('tmpStyle')
  if (degree<100){
  degree+=5
  if (objG.filters&&objG.filters[0]&&fadeAssist)
  fadeAssist(objG, degree)
  else if (typeof objG.style.MozOpacity=='string')
  objG.style.MozOpacity=degree/101
  else if (typeof objG.style.KhtmlOpacity=='string')
  objG.style.KhtmlOpacity=degree/100
  else if (typeof objG.style.opacity=='string'&&!objG.filters)
  objG.style.opacity=degree/101
  else
  tS.disabled=true
  setTimeout("fadepic(objG)", 50)
  }
  else
  tS.disabled=true
  }  

  
  
  function toggleSlider() {
  if ($("#panelThatSlides").is(":visible")) {
  $("#contentThatFades").animate(
  {
  opacity: "0"
  },
  600,
  function(){
  $("#panelThatSlides").slideUp();
  }
  );
  }
  else {
  $("#panelThatSlides").slideDown(600, function(){
  $("#contentThatFades").animate(
  {
  opacity: "1"
  },
  600
  );
  });
  }
  }
  </script>  
  

Open in new window

0
Comment
Question by:rgb192
3 Comments
 
LVL 82

Accepted Solution

by:
Dave Baldwin earned 250 total points
ID: 39217130
Your file combines both regular javascript and jquery.  Are you loading the main jquery file before this one?

And I dont' see any PHP in what you posted.  I wouldn't do it that way, I would include that in the main HTML part of the page.
0
 
LVL 108

Assisted Solution

by:Ray Paseur
Ray Paseur earned 250 total points
ID: 39217479
JavaScript (including jQuery) runs on the client computer, not on your server.  The PHP script that prepares the HTML document runs on your server, but not on the client computer.  The PHP script must run first and be complete before the client computer can start to run the JavaScript.  PHP is used to generate HTML, JavaScript and CSS.  The process of generation can mean direct output into the browser stream like echo, or you can generate HTML statements that load other files, like <link> tags.

Since we do not have the PHP script in evidence here, it's hard to know how to advise you.
0
 

Author Closing Comment

by:rgb192
ID: 39217931
I include that in the main HTML part of the page.
and
i took out the
<script></script> in the js file and the javascript/jquery ran
0

Featured Post

Free Trending Threat Insights Every Day

Enhance your security with threat intelligence from the web. Get trending threat insights on hackers, exploits, and suspicious IP addresses delivered to your inbox with our free Cyber Daily.

Join & Write a Comment

PROBLEM: The other day I was working on adding an ajax request to a webpage that already had a dialog box on the page.  The dialog box was using relative positioning to be positioned next to a form field I had on the page.  Everything was working…
Since pre-biblical times, humans have sought ways to keep secrets, and share the secrets selectively.  This article explores the ways PHP can be used to hide and encrypt information.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
This tutorial will teach you the core code needed to finalize the addition of a watermark to your image. The viewer will use a small PHP class to learn and create a watermark.

760 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

18 Experts available now in Live!

Get 1:1 Help Now