IPB

Welcome Guest ( Log In | Register )


 
Reply to this topicStart new topic
> Javascript help, i'm an idiot somewhere
woody
post Jul 27 2006, 11:39 PM
Post #1





Group: Moderators
Posts: 2,499
Joined: 23-February 06
From: El Paso Texas
Member No.: 32



i got this toggle JS code that works in IE but not Firefox

java script:
QUOTE
<script language="javascript">
<!--
function toggle(targetId)
{
    target = document.all(targetId);
    if (target.style.display == "none")
      {
        target.style.display="";
      }
    else
      {
        target.style.display="none";
      }
}
//-->
</script>


And when i call it:
QUOTE
<a href="java script:toggle('Name')">Click Here Thingie</a> <br />
  <div id="Name" style="display:none">
    <div alighn="justify">
        <font color="#000000" size="1"><? include('name.php');?></font>
    </div>
  </div>


any ideas?


--------------------
Go to the top of the page
 
+Quote Post
Frantic
post Jul 28 2006, 10:23 AM
Post #2





Group: Members
Posts: 21
Joined: 27-March 06
Member No.: 130



I noticed a couple of things

QUOTE
//-->

Isn't this commenting out the end of the script?
QUOTE
<? include('name.php');?>

My installation of PHP has to start with <?PHP blah ?>
Go to the top of the page
 
+Quote Post
Hartmann
post Jul 28 2006, 11:35 AM
Post #3





Group: Admin
Posts: 3,403
Joined: 23-February 06
From: PDX/TXL
Member No.: 35



QUOTE (Frantic @ Jul 28 2006, 10:23 AM)
I noticed a couple of things


Isn't this commenting out the end of the script?

My installation of PHP has to start with <?PHP blah ?>

No it doesn't comment out the end of the script, it simply hides it from browsers that don't understand Javascript.

Certain PHP installations need the <?php opening tag, others don't. Try both. The one that's "<?php" is technically proper.


--------------------

"There is a level of cowardice lower than that of the conformist: that of the fashionable non-conformist."
Go to the top of the page
 
+Quote Post
Hartmann
post Jul 28 2006, 11:38 AM
Post #4





Group: Admin
Posts: 3,403
Joined: 23-February 06
From: PDX/TXL
Member No.: 35



This works fine for me in Firefox. Do you have the Javascript in the head section of your HTML? What is in your name.php file?


--------------------

"There is a level of cowardice lower than that of the conformist: that of the fashionable non-conformist."
Go to the top of the page
 
+Quote Post
woody
post Jul 30 2006, 04:13 PM
Post #5





Group: Moderators
Posts: 2,499
Joined: 23-February 06
From: El Paso Texas
Member No.: 32



QUOTE (Hartmann @ Jul 28 2006, 11:38 AM)
This works fine for me in Firefox. Do you have the Javascript in the head section of your HTML? What is in your name.php file?

javascript is int he head

the php file is just a paragraph of text


--------------------
Go to the top of the page
 
+Quote Post
Hartmann
post Jul 30 2006, 09:44 PM
Post #6





Group: Admin
Posts: 3,403
Joined: 23-February 06
From: PDX/TXL
Member No.: 35



QUOTE (woody @ Jul 30 2006, 04:13 PM)
javascript is int he head

the php file is just a paragraph of text

Is it being echo'd in the PHP file?

Do a view source in Firefox when you first load the page, and then after you click the button. See if they are the same or different.


--------------------

"There is a level of cowardice lower than that of the conformist: that of the fashionable non-conformist."
Go to the top of the page
 
+Quote Post
zetec
post Aug 1 2006, 04:52 PM
Post #7


Retired Funk-bringer


Group: Moderators
Posts: 2,656
Joined: 22-February 06
From: Dallas
Member No.: 14



make sure you have the latest JRE.

you probably do, but it's always worth mentioning.


--------------------
WAIT. I'm not finished.
Go to the top of the page
 
+Quote Post
Hartmann
post Aug 2 2006, 07:22 AM
Post #8





Group: Admin
Posts: 3,403
Joined: 23-February 06
From: PDX/TXL
Member No.: 35



QUOTE (zetec @ Aug 1 2006, 04:52 PM)
make sure you have the latest JRE.

you probably do, but it's always worth mentioning.

Javascript != Java so runtime environment does not matter. The browser matters.

Which begs the question, what extensions do you have installed for Firefox?


--------------------

"There is a level of cowardice lower than that of the conformist: that of the fashionable non-conformist."
Go to the top of the page
 
+Quote Post
zetec
post Aug 5 2006, 08:23 PM
Post #9


Retired Funk-bringer


Group: Moderators
Posts: 2,656
Joined: 22-February 06
From: Dallas
Member No.: 14



i was only half paying attention. still am. i haven't had a day off of work in nearly three weeks now.



overtime is fun


--------------------
WAIT. I'm not finished.
Go to the top of the page
 
+Quote Post

Reply to this topicStart new topic
1 User(s) are reading this topic (1 Guests and 0 Anonymous Users)
0 Members:

 



Lo-Fi Version Time is now: 11th June 2026 - 02:31 AM
Skin made by: skeedio.com