Solved

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

Posted on 2013-06-03
3
538 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 83

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

3 Use Cases for Connected Systems

Our Dev teams are like yours. They’re continually cranking out code for new features/bugs fixes, testing, deploying, testing some more, responding to production monitoring events and more. It’s complex. So, we thought you’d like to see what’s working for us.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

JavaScript can be used in a browser to change parts of a webpage dynamically. It begins with the following pattern: If condition W is true, do thing X to target Y after event Z. Below are some tips and tricks to help you get started with JavaScript …
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
Learn how to match and substitute tagged data using PHP regular expressions. Demonstrated on Windows 7, but also applies to other operating systems. Demonstrated technique applies to PHP (all versions) and Firefox, but very similar techniques will w…
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.

867 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

13 Experts available now in Live!

Get 1:1 Help Now