Oh no! Where's the JavaScript?
Your Web browser does not have JavaScript enabled or does not support JavaScript. Please enable JavaScript on your Web browser to properly view this Web site, or upgrade to a Web browser that does support JavaScript.
Not a member yet? Click here to register.
Forgot Password?

Panel Help

Asked Modified Viewed 2,878 times
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
asked
Senior Member

I believe that I have changed all of the "s to 's in the following code, but I can't get it to work in a panel. Can anyone see where the problem is?

openside("name");
  echo "<div class='txt' style='padding-top:5px;'>";
               echo"<form name='jumpy'>";
  echo"<select name='1example' size=111 onChange='gone()'>";
    echo"<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo"<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    echo"<option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       echo"<option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>";
 echo"</select>";
echo"</form>";
echo"<script language='javascript'>";
 echo "var displaymode='0'";
 


echo "var iframecode='<center><iframe id='external' style='width:200;height:220;' src='http://www.sportsline.com/nfl/box-scoreboards' scrolling='auto' border=0 marginwidth=1 marginheight=1 align=center frameborder=0></iframe></center>";
 
echo "if (displaymode=='0') {";
   echo "document.write(iframecode)";
echo "}";
 
echo "function gone(){";
   echo "var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value";
echo "if (document.getElementById&&displaymode=='0') {";
      echo "document.getElementById('external').src=selectedurl";
   echo "} else if (document.all&&displaymode=='0') {";
      echo "document.all.external.src=selectedurl";
   echo "} else {";
      echo "if (!window.win2||win2.closed) {";
         echo "win2=window.open(selectedurl)";
      echo "} else {";
         echo "win2.location=selectedurl";
         echo "win2.focus()";
      echo" }";
   echo "}";
echo "}";
echo "</script>";
               echo "</div>";
closeside();
0 replies

13 posts

M
Mangee
M
Mangee 10
Mangee's Conversions

Convert
  • Senior Member, joined since
  • Contributed 242 posts on the community forums.
  • Started 30 threads in the forums
answered
Senior Member

The javascript has to be read as a function.

So the echo" and "; on its code is not used example from php-fusion maincore.php file

      echo "<script type='text/javascript'>document.location.href='".str_replace("&amp;", "&", $location)."'</script>\n";
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks Mangee, I made the changes you suggested and the error msgs stopped. However, this script is supposed to pull sports scores, and all I am getting is a drop down menu, but no scores being pulled. Hopefully you can see where my mistake is after updating the code?

openside("name");
  echo "<div class=txt' style='padding-top:5px'>";
               echo "<form name='jumpy'>";
  echo "<select name='example' size='1' onChange='gone()'>";
    echo "<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    echo "<option value='http://www.sportsline.com/nhl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/nba/box-scoreboards'>NBA</option>";
    echo "<option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       echo "<option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>";
  echo "</select>";
echo "</form>";
echo "<br>";

echo "<script language='javascript'>
var displaymode=0;
 


var iframecode='<center><iframe id='external' style='width:200;height:220;' src='http://www.sportsline.com/nfl/box-scoreboards' scrolling='auto' border=0 marginwidth=1 marginheight=1 align=center frameborder=0></iframe></center>';
 
if (displaymode==0) {
   document.write(iframecode);
}
 
function gone(){
   var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value;
   if (document.getElementById&&displaymode==0) {
      document.getElementById('external').src=selectedurl;
   } else if (document.all&&displaymode==0) {
      document.all.external.src=selectedurl;
   } else {
      if (!window.win2||win2.closed) {
         win2=window.open(selectedurl);
      } else {
         win2.location=selectedurl;
         win2.focus();
      }
   }
}
</script>\n";
closeside();
0 replies
M
Mangee
M
Mangee 10
Mangee's Conversions

Convert
  • Senior Member, joined since
  • Contributed 242 posts on the community forums.
  • Started 30 threads in the forums
answered
Senior Member

Your using a dynamicdrive viewer

http://www.dynamicdrive.com/dynamicin...ew_dev.htm

You have a function called " gone " but at no place do you have a call for it.

Look at the original

<input type="button" name="test" value="Go!" onClick="gone()">


A button :@ most likely its needed.
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

Thanks again Mangee. I added the button but it made no difference. It is still not working. If you take the code I posted and add it to an html page it works the way it is supposed to so I am assuming that I have entered the code incorrectly trying to get it to display in a panel.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

You need to add the JavaScript to the footer.

add_to_footer("");
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

I'm confused, do you mean enter the entire java script code shown between the "" in your post?
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Try this man....

openside("name");
  echo "<div class=txt' style='padding-top:5px'>";
               echo "<form name='jumpy'>";
  echo "<select name='example' size='1' onChange='gone()'>";
    echo "<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    echo "<option value='http://www.sportsline.com/nhl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/nba/box-scoreboards'>NBA</option>";
    echo "<option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       echo "<option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>";
  echo "</select>";
echo "</form>";
echo "<br>";

add_to_footer( "<script language='javascript'>
var displaymode=0;
var iframecode='<center><iframe id='external' style='width:200;height:220;' src='http://www.sportsline.com/nfl/box-scoreboards' scrolling='auto' border=0 marginwidth=1 marginheight=1 align=center frameborder=0></iframe></center>';
 
if (displaymode==0) {
   document.write(iframecode);
}
 
function gone(){
   var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value;
   if (document.getElementById&&displaymode==0) {
      document.getElementById('external').src=selectedurl;
   } else if (document.all&&displaymode==0) {
      document.all.external.src=selectedurl;
   } else {
      if (!window.win2||win2.closed) {
         win2=window.open(selectedurl);
      } else {
         win2.location=selectedurl;
         win2.focus();
      }
   }
}
</script>");
closeside();
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

I really appreciate your help fangree_craig but all I still get is the drop down menu of items. It is not pulling the scores as it does if the code were to be included in an html page.
0 replies
C
Craig
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
answered
Fusioneer

Can you show me where you got the script? If I can see the original Script I will be able to figure it out better.
0 replies
M
Mangee
M
Mangee 10
Mangee's Conversions

Convert
  • Senior Member, joined since
  • Contributed 242 posts on the community forums.
  • Started 30 threads in the forums
answered
Senior Member

Ok I got it to work.

One thing is the javascript does not have to be call at footer. If its called in the file it is echo ' not echo".

<?php

if (!defined("IN_FUSION")) { die("Access Denied"); }
openside("name");
echo "<form name='jumpy'><select name='example' size='1' onChange='gone()'>\n";
    echo "<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    echo "<option value='http://www.sportsline.com/nhl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/nba/box-scoreboards'>NBA</option>";
    echo "<option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       echo "<option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>";
echo"</select>

<input type='button' name='test' value='Go!' onClick='gone()' />
</form>\n";
closeside();
echo '<script type="text/javascript">



var displaymode=1



/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else{
if (!window.win2||win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}

</script>';


?>


Also remeber the infusion panel folder is xxxx_panel and its file is xxxx_panel.php.

I can put it up on a demo to see.

Craig you can see it where the pumpkin theme is.

I also did yours Craig with some changes and it worked.

<?php

openside("name");
  echo "<div class=txt' style='padding-top:5px'>";
               echo "<form name='jumpy'>";
  echo "<select name='example' size='1' onChange='gone()'>";
    echo "<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    echo "<option value='http://www.sportsline.com/nhl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/nba/box-scoreboards'>NBA</option>";
    echo "<option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       echo "<option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>";
echo"</select>

<input type='button' name='test' value='Go!' onClick='gone()' />
</form>\n";
echo "</div><br />";
if(function_exists('add_to_head')){
add_to_head( "<script language='javascript'>
var displaymode=1;

 
if (displaymode==0) {
   document.write(iframecode);
}
 
function gone(){
   var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value;
   if (document.getElementById&&displaymode==0) {
      document.getElementById('external').src=selectedurl;
   } else if (document.all&&displaymode==0) {
      document.all.external.src=selectedurl;
   } else {
      if (!window.win2||win2.closed) {
         win2=window.open(selectedurl);
      } else {
         win2.location=selectedurl;
         win2.focus();
      }
   }
}
</script>");}
closeside();


?>
Edited by Mangee on 06-10-2011 19:01,
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

Thank you Mangee...I set it up using scores_panel as the panel and scores_panel.php as the file. However it only works by opening a new page out of phpfusion, rather than opening it up in the panel. I changed the line
var displaymode=1
to
var displaymode=0
and at that point all I got was the drop down menu and the Go button without getting the scores listed. Will it not work in a panel?
0 replies
M
Mangee
M
Mangee 10
Mangee's Conversions

Convert
  • Senior Member, joined since
  • Contributed 242 posts on the community forums.
  • Started 30 threads in the forums
answered
Senior Member

I am the worst person to help because I cant do php punctuation.

So I cheated. In the php I called the html.

<?php
if (!defined("IN_FUSION")) { die("Access Denied"); }
openside("name");
?>
<form name="jumpy">
<select name="example" size="1" onChange="gone()">
<!-- CHANGE THE BELOW URLS TO YOUR OWN-->
<option value='http://www.sportsline.com/nfl/box-scoreboards'>NFL</option>";
    echo "<option value='http://www.sportsline.com/mlb/box-scoreboards'>MLB</option>";
    <option value='http://www.sportsline.com/nhl/box-scoreboards'>NFL</option>";
    <option value='http://www.sportsline.com/nba/box-scoreboards'>NBA</option>";
    <option value='http://www.sportsline.com/collegefootball/box-scoreboards'>NCAA Football</option>";
       <option value='http://www.sportsline.com/collegebasketball/box-scoreboards'>NCAA Basketball</option>
</select>

<input type="button" name="test" value="Go!" onClick="gone()">
</form>

<script language="javascript">
<!--

//Drop-down Document Viewer- © Dynamic Drive (www.dynamicdrive.com)
//For full source code, 100's more DHTML scripts, and TOS,
//visit http://www.dynamicdrive.com

//Specify display mode (0 or 1)
//0 causes document to be displayed in an inline frame, while 1 in a new browser window
var displaymode=0
//if displaymode=0, configure inline frame attributes (ie: dimensions, intial document shown
var iframecode='<iframe id="external" style="width:160px;height:400px" src="http://www.sportsline.com/mlb/box-scoreboards"></iframe>'

/////NO NEED TO EDIT BELOW HERE////////////

if (displaymode==0)
document.write(iframecode)

function gone(){
var selectedurl=document.jumpy.example.options[document.jumpy.example.selectedIndex].value
if (document.getElementById&&displaymode==0)
document.getElementById("external").src=selectedurl
else if (document.all&&displaymode==0)
document.all.external.src=selectedurl
else{
if (!window.win2||win2.closed)
win2=window.open(selectedurl)
//else if win2 already exists
else{
win2.location=selectedurl
win2.focus()
}
}
}
//-->
</script>
<?php
closeside();
?>


The line of code

var iframecode='<iframe id="external" style="width:160px;height:400px" src="http://www.sportsline.com/mlb/box-scoreboards"></iframe>'


was stopping everything but I couldn't get the punctuation to work.
0 replies
A
afoster
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
answered
Senior Member

It works...thank you very much.
0 replies

Category Forum

Panels and Infusions

Labels

None yet

Statistics

  • Views 0 views
  • Posts 13 posts
  • Votes 0 votes
  • Topic users 3 members

3 participants

C
C
Craig 14
  • Fusioneer, joined since
  • Contributed 4,462 posts on the community forums.
  • Started 212 threads in the forums
A
A
  • Senior Member, joined since
  • Contributed 725 posts on the community forums.
  • Started 128 threads in the forums
  • Started this discussions
M
M
Mangee 10
Mangee's Conversions

Convert
  • Senior Member, joined since
  • Contributed 242 posts on the community forums.
  • Started 30 threads in the forums

Notifications

Track thread

You are not receiving notifications from this thread.

Related Questions

Not yet