Solved

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

Posted on 2013-06-03
3
542 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
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 110

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 Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

Question has a verified solution.

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

Introduction If you're like most people, you have occasionally made a typographical error when you're entering information into an online form.  And to your consternation, the browser remembers the error, and offers to autocomplete your future entr…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to count occurrences of each item in an array.
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…

749 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