Java script alert problem in IE6

JavaScript and client side scripting.

Moderator: General Moderators

Post Reply
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Java script alert problem in IE6

Post by valen53 »

Testing PC.
PC1 : w2k, IE5 ;
PC2 : win98 IE6

alert1.php

Code: Select all

<?
if ( $Submit == 'Submit' ) &#123;
 echo'
   <script language="JavaScript1.2">
     alert("Data updated ! ");
   </script>';
 &#125;
?>

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
</head>

<body>
<form name="form1" method="post" action="alert1.php">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
PC1 : correctly, alert the message one time
PC2 : wrongly, alert the message twice time

anybody face this problem b4 ? is it IE6 setting problem ?
User avatar
Derfel Cadarn
Forum Contributor
Posts: 193
Joined: Thu Jul 17, 2003 12:02 pm
Location: Berlin, Germany

Post by Derfel Cadarn »

After changing one line into the following:

Code: Select all

<?php
if ( $_POST['Submit'] == 'Submit' ) {
?>
it worked fine in Mozilla with me.
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post by igoy »

well... will and without register_globals on..
when i tested this code on XP system with ie6 (sp1).. it worked fine..
I suppose your problem must be with your ie6 settings.
User avatar
scorphus
Forum Regular
Posts: 589
Joined: Fri May 09, 2003 11:53 pm
Location: Belo Horizonte, Brazil
Contact:

Post by scorphus »

Make PHP to write the <script...>...</script> tag inside <head> tag. I may be the reason why PC2 wont display the alert. Changed to:

Code: Select all

<html>
<head>
<title>Untitled Document</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<?
if ( $Submit == 'Submit' ) {
echo'
   <script language="JavaScript1.2">
     alert("Data updated ! ");
   </script>';
}
?>
</head>

<body>
<form name="form1" method="post" action="alert1.php">
  <input type="submit" name="Submit" value="Submit">
</form>
</body>
</html>
The <script> was before <html> tag and it doesn't complies with standard HTML specification.

Cheers,
Scorphus.
m3rajk
DevNet Resident
Posts: 1191
Joined: Mon Jun 02, 2003 3:37 pm

Post by m3rajk »

i'm going to have to agree with scorphus for two reasons:

1: it's better to conform to standards since it makes your site more widely compatable, and may cause issues like that if you don't.

2: when i had an issue with javascript he fixed it in about 30 seconds, so he obviously knows it, and from what i've seen looking around this forum, he knows it well
valen53
Forum Contributor
Posts: 137
Joined: Tue Aug 27, 2002 9:29 am

Post by valen53 »

it was working when changing the code like

Code: Select all

<html> 
<head> 
<title>Untitled Document</title> 
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"> 
<? 
if ( $Submit == 'Submit' ) &#123; 
echo' 
   <script language="JavaScript1.2"> 
     alert("Data updated ! "); 
   </script>'; 
&#125; 
?> 
</head>
thanks for reply
User avatar
igoy
Forum Contributor
Posts: 203
Joined: Fri May 02, 2003 11:57 pm
Location: India
Contact:

Post by igoy »

Head.. HEAD... HeAd.... eeeeeeeeeeeeeee..

why the hell that didn't occured to me ??????....

first.. I was stupid enough to think there is no problem with it since it ran properly on my system.
second.. rule braking has got me so much that i have started to forget thing called "standard"

dobby musdt punish himself... err.. yogi must punish himself....
Post Reply