Current location: Hot Scripts Forums » General Web Coding » JavaScript » JS script not working properly on IE but working on Firefox!!!


JS script not working properly on IE but working on Firefox!!!

Reply
  #1 (permalink)  
Old 05-17-07, 03:47 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
JS script not working properly on IE but working on Firefox!!!

hi!

i have made a form on CGI script which have dropdown content on selection any data its should display its corespondance data on respective datfile.

http://www.k****ij.com/cgi-bin/funnymentalsedit.cgi

s h i t please replace the '*' in url with this word without space

the code is:

Code:
#!/usr/bin/perl -w
use CGI qw(:standard);
use CGI::Carp qw(fatalsToBrowser);
$query = new CGI;
my ($mailprog) ;
$mailprog = '/usr/sbin/sendmail -t';
 
# for saveing these files#
$file1 = "XXXX/funnymentalsdatfile/funnytemp.dat";
$file2 = "XXXX/funnymentalsdatfile/funnytemp2.dat";
# funchart data files#
$filename1 = "XXXX/funnymentals/usism.html";
$filename2 = "XXXX/funnymentals/usnfp.html";
$filename3 = "XXXX/funnymentals/ustrade.html";
$filename4 = "XXXX/funnymentals/usppi.html";
$filename5 = "XXXX/funnymentals/ushousing.html";
$filename6 = "XXXX/funnymentals/uscpi.html";
$filename7 = "XXXX/funnymentals/ustics.html";
$filename8 = "XXXX/funnymentals/usdurable.html";
$filename9 = "XXXX/funnymentals/usgdp.html";
$filename10 = "XXXX/funnymentals/uspersonal.html";
$filename11 = "XXXX/funnymentals/gerifo.html";
$filename12 = "XXXX/funnymentals/ukboe.html";
$filename13 = "XXXX/funnymentals/aurba.html";
$filename14 = "XXXX/funnymentals/jpboj.html";
$filename15 = "XXXX/funnymentals/chsnb.html";
$filename16 = "XXXX/funnymentals/auslabour.html";
$filename17 = "XXXX/funnymentals/austrade.html";
$filename18 = "XXXX/funnymentals/uktrade.html";
 
$URL = "http://www.k****ij.com/utilities/fun...ymentals.shtml";
 
open (HEADER, "/home/k****ijc/www/kcsinclude/inclsubheader.html");
@header = <HEADER>;
close(HEADER);
 
open (MENU, "/home/k****ijc/www/kcsinclude/fxmenuleftinclcom.html");
@menu = <MENU>;
close(MENU);
open (FOOTER, "/home/k****ijc/www/kcsinclude/inclfooter.html");
@footer = <FOOTER>;
close(FOOTER);
 
#### getting data from a temp file and stored them into each fileds of the form
#--------------------------------------------------------------------------------
$act = $query->param('action');
if ($act eq "")  {
&print_form;
}
if ($act eq "Edit") {
                &get_results;
                &get_data;
                &display_HTML;
}
sub get_results {
$mess = $query->param('mess');
$chart = $query->param('select1');
$mess5 = $query->param('mess5');
#$mess =~ s/\r?\n/<br>/g;
#$mess1 =~ s/\r?\n/\n/g;
}
sub get_data {
#### write the new entry
#--------------------------
open(DATAFILE,"<$file1") || die "Can't Open $file1: $!\n";
$serial = "";
while ($line = <DATAFILE>) {
$serial = $serial . $line;
}
close(DATAFILE);
#### write the new entry
#-----------------------
open(DATAF,">$file1") or die "Can't Open $file1: $!\n";
print DATAF ($mess);
close(DATAF);
 
   if ($chart eq "usism")
   {
   use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/usism.dat") or die "copy failed: $!";
   use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/usism.html") or die "copy failed: $!"; 
   }
 
   if ($chart eq "usnfp")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/usnfp.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/usnfp.html") or die "copy failed: $!"; 
   }
 
   if ($chart eq "ustrade")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/ustrade.dat") or die "copy failed: $!"; 
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/ustrade.html") or die "copy failed: $!"; 
   }
 
   if ($chart eq "usppi")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/usppi.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/usppi.html") or die "copy failed: $!"; 
   }
 
   if ($chart eq "ushousing")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/ushousing.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/ushousing.html") or die "copy failed: $!"; 
   }
 
   if ($chart eq "uscpi")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/uscpi.dat") or die "copy failed: $!"; 
  use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/uscpi.html") or die "copy failed: $!";
   }
 
   if ($chart eq "ustics")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/ustics.dat") or die "copy failed: $!"; 
  use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/ustics.html") or die "copy failed: $!"; 
   }
   if ($chart eq "usdurable")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/usdurable.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/usdurable.html") or die "copy failed: $!"; 
   }
   if ($chart eq "usgdp")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/usgdp.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/usgdp.html") or die "copy failed: $!"; 
   }
   if ($chart eq "uspersonal")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/uspersonal.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/uspersonal.html") or die "copy failed: $!"; 
   }
   if ($chart eq "gerifo")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/gerifo.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/gerifo.html") or die "copy failed: $!"; 
   }
   if ($chart eq "ukboe")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/ukboe.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/ukboe.html") or die "copy failed: $!"; 
   }
   if ($chart eq "aurba")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/aurba.dat") or die "copy failed: $!";
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/aurba.html") or die "copy failed: $!"; 
   }
   if ($chart eq "jpboj")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/jpboj.dat") or die "copy failed: $!";
  use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/jpboj.html") or die "copy failed: $!"; 
   }
   if ($chart eq "chsnb")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/chsnb.dat") or die "copy failed: $!"; 
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/chsnb.html") or die "copy failed: $!"; 
   }
   if ($chart eq "auslabour")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/auslabour.dat") or die "copy failed: $!";
 use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/auslabour.html") or die "copy failed: $!"; 
   }
   if ($chart eq "austrade")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/austrade.dat") or die "copy failed: $!"; 
  use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/austrade.html") or die "copy failed: $!"; 
   }
   if ($chart eq "uktrade")
   {
  use File::Copy;
#copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentalsdatfile/uktrade.dat") or die "copy failed: $!"; 
  use File::Copy;
copy("XXXX/funnymentalsdatfile/funnytemp.dat", "XXXX/funnymentals/uktrade.html") or die "copy failed: $!"; 
   }
 
}
 
sub print_form {
open (TEMP,"$filename1") or die "Can't Open $filename1: $!\n";
while ($line = <TEMP>) {
$data1 = $data1 . $line;
}
close(TEMP);
 
open (TEMP,"$filename2") or die "Can't Open $filename2: $!\n";
while ($line = <TEMP>) {
$data2 = $data2 . $line;
}
close(TEMP);
 
open (TEMP,"$filename3") or die "Can't Open $filename3: $!\n";
while ($line = <TEMP>) {
$data3 = $data3 . $line;
}
close(TEMP);
 
open (TEMP,"$filename4") or die "Can't Open $filename4: $!\n";
while ($line = <TEMP>) {
$data4 = $data4 . $line;
}
close(TEMP);
open (TEMP,"$filename5") or die "Can't Open $filename5: $!\n";
while ($line = <TEMP>) {
$data5 = $data5 . $line;
}
close(TEMP);
open (TEMP,"$filename6") or die "Can't Open $filename6: $!\n";
while ($line = <TEMP>) {
$data6 = $data6 . $line;
}
close(TEMP);
open (TEMP,"$filename7") or die "Can't Open $filename7: $!\n";
while ($line = <TEMP>) {
$data7 = $data7 . $line;
}
close(TEMP);
open (TEMP,"$filename8") or die "Can't Open $filename8: $!\n";
while ($line = <TEMP>) {
$data8 = $data8 . $line;
}
close(TEMP);
open (TEMP,"$filename9") or die "Can't Open $filename9: $!\n";
while ($line = <TEMP>) {
$data9 = $data9 . $line;
}
close(TEMP);
open (TEMP,"$filename10") or die "Can't Open $filename10: $!\n";
while ($line = <TEMP>) {
$data10 = $data10 . $line;
}
close(TEMP);
open (TEMP,"$filename11") or die "Can't Open $filename11: $!\n";
while ($line = <TEMP>) {
$data11 = $data11 . $line;
}
close(TEMP);
open (TEMP,"$filename12") or die "Can't Open $filename12: $!\n";
while ($line = <TEMP>) {
$data12 = $data12 . $line;
}
close(TEMP);
open (TEMP,"$filename13") or die "Can't Open $filename13: $!\n";
while ($line = <TEMP>) {
$data13 = $data13 . $line;
}
close(TEMP);
open (TEMP,"$filename14") or die "Can't Open $filename14: $!\n";
while ($line = <TEMP>) {
$data14 = $data14 . $line;
}
close(TEMP);
open (TEMP,"$filename15") or die "Can't Open $filename15: $!\n";
while ($line = <TEMP>) {
$data15 = $data15 . $line;
}
close(TEMP);
open (TEMP,"$filename16") or die "Can't Open $filename16: $!\n";
while ($line = <TEMP>) {
$data16 = $data16 . $line;
}
close(TEMP);
open (TEMP,"$filename17") or die "Can't Open $filename17: $!\n";
while ($line = <TEMP>) {
$data17 = $data17 . $line;
}
close(TEMP);
open (TEMP,"$filename18") or die "Can't Open $filename18: $!\n";
while ($line = <TEMP>) {
$data18 = $data18 . $line;
}
close(TEMP);
print "Content-type: text/html\n\n";
print <<"HTML";
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD><title>Funny-Mentals EDIT Form</title>
<META http-equiv=Content-Type content="text/html; charset=windows-1252">
<style>
.submitbutton {
BACKGROUND-COLOR: #BFD2E7;
FORE-COLOR: #FF8000; 
font-weight: bold;
}
</style>
</head>
<body bgcolor="#e0e0e0" text="#000000" link="#0000FF" vlink="#008000">
<p align="right"><font color="#008000" size="5" style="font-family: verdana; font-weight: bold"><em>Funny-Mentals EDIT Form<br>
    <img src="../images/green.gif" width="100%" height="2" alt=""></em></font></p>
<FORM name="form1" method="post" align="center">
<table bgcolor="fff5f5" border="0" cellpadding="5" cellspacing="0" width="750" align="center">
<TBODY>
<tr bgcolor=\"\#fff5f5\"> 
            <td><b>Select chart type: &nbsp;&nbsp;&nbsp;</b>
<select name="select1" size="1" style="background-color:#FFFFD7" onChange="displaydesc(document.form1.select1, thetext1, 'textcontainer1')">
HTML
   print "<option value=\"usism\" selected>usism &nbsp; \n";
   print "<option value=\"usnfp\">usnfp &nbsp;  \n";
   print "<option value=\"ustrade\">ustrade &nbsp; \n";
   print "<option value=\"usppi\">usppi &nbsp;\n";
   print "<option value=\"ushousing\">ushousing&nbsp;\n";
   print "<option value=\"uscpi\">uscpi&nbsp;\n";
   print "<option value=\"ustics\">ustics &nbsp;\n";
   print "<option value=\"usdurable\">usdurable &nbsp;\n";
   print "<option value=\"usgdp\">usgdp &nbsp;\n";
   print "<option value=\"uspersonal\">uspersonal &nbsp;\n";
   print "<option value=\"gerifo\">gerifo &nbsp;\n";
   print "<option value=\"ukboe\">ukboe &nbsp;\n";
   print "<option value=\"aurba\">aurba &nbsp;\n";
   print "<option value=\"jpboj\">jpboj &nbsp;\n";
   print "<option value=\"chsnb\">chsnb &nbsp;\n";
   print "<option value=\"auslabour\">auslabour &nbsp;\n";
   print "<option value=\"austrade\">austrade &nbsp;\n";
   print "<option value=\"uktrade\">uktrade &nbsp;\n";
print <<"HTML";
     </select></td></tr>
   <tr>
     <td width="100">Matter:<TEXTAREA name="mess" rows="25" wrap=virtual cols="100" id="textcontainer1" align="left" style="font:12px verdana"></TEXTAREA>
</td></tr>
<TR>
    <TD>
      <CENTER><input class="submitbutton" type="submit" value="Edit" name=action> 
</CENTER>
</TD></TR>
</TBODY></TABLE>
</FORM>
<script type="text/javascript">
var thetext1=new Array()
thetext1[0]= '$data1'
thetext1[1]= '$data2'
thetext1[2]= '$data3'
thetext1[3]= '$data4'
thetext1[4]= '$data5'
thetext1[5]= '$data6'
thetext1[6]= '$data7'
thetext1[7]= '$data8'
thetext1[8]= '$data9'
thetext1[9]= '$data10'
thetext1[10]= '$data11'
thetext1[11]= '$data12'
thetext1[12]= '$data13'
thetext1[13]= '$data14'
thetext1[14]= '$data15'
thetext1[15]= '$data16'
thetext1[16]= '$data17'
thetext1[17]= '$data18'
function displaydesc(which, descriptionarray, container){
if (document.getElementById)
document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]
}
displaydesc(document.form1.select1, thetext1, 'textcontainer1')
</script>
</BODY></HTML>
HTML
exit;
}
 
sub display_HTML {
   if ($chart eq "usism")
   {
   print "Location: http://www.k****ij.com/utilities/fun...sism.shtml\n\n"; 
   }
 
   if ($chart eq "usnfp")
   {
  print "Location: http://www.k****ij.com/utilities/fun...snfp.shtml\n\n"; 
   }
 
   if ($chart eq "ustrade")
   {
  print "Location: http://www.k****ij.com/utilities/fun...rbal.shtml\n\n"; 
   }
 
   if ($chart eq "usppi")
   {
  print "Location: http://www.k****ij.com/utilities/fun...sppi.shtml\n\n"; 
   }
 
   if ($chart eq "ushousing")
   {
  print "Location: http://www.k****ij.com/utilities/fun...arts.shtml\n\n"; 
   }
 
   if ($chart eq "uscpi")
   {
  print "Location: http://www.k****ij.com/utilities/fun...scpi.shtml\n\n";
   }
 
   if ($chart eq "ustics")
   {
  print "Location: http://www.k****ij.com/utilities/fun...tics.shtml\n\n"; 
   }
   if ($chart eq "usdurable")
   {
  print "Location: http://www.k****ij.com/utilities/fun...sdur.shtml\n\n"; 
   }
   if ($chart eq "usgdp")
   {
  print "Location: http://www.k****ij.com/utilities/fun...sgdp.shtml\n\n"; 
   }
   if ($chart eq "uspersonal")
   {
  print "Location: http://www.k****ij.com/utilities/fun...rinc.shtml\n\n"; 
   }
   if ($chart eq "gerifo")
   {
  print "Location: http://www.k****ij.com/utilities/fun...rifo.shtml\n\n"; 
   }
   if ($chart eq "ukboe")
   {
  print "Location: http://www.k****ij.com/utilities/fun...sfed.shtml\n\n"; 
   }
   if ($chart eq "aurba")
   {
  print "Location: http://www.k****ij.com/utilities/fun...urba.shtml\n\n"; 
   }
   if ($chart eq "jpboj")
   {
  print "Location: http://www.k****ij.com/utilities/fun...pboj.shtml\n\n"; 
   }
   if ($chart eq "chsnb")
   {
  print "Location: http://www.k****ij.com/utilities/fun.../snb.shtml\n\n"; 
   }
   if ($chart eq "auslabour")
   {
  print "Location: http://www.k****ij.com/utilities/fun...ulab.shtml\n\n"; 
   }
   if ($chart eq "austrade")
   {
   print "Location: http://www.k****ij.com/utilities/fun...rbal.shtml\n\n"; 
   }
   if ($chart eq "uktrade")
   {
  print "Location: http://www.k****ij.com/utilities/fun...rbal.shtml\n\n"; 
   }
#print "Location: $URL\n\n";
}
the problem is, its not showing the respective data on chosing the option from drop down, all of them no have data but 3 frields have data, which is woring fine with firefox, but on IE. if you go to Page source you can see the data are assigned to the each variable. but not showing them on IE.

JAVASCRIPT code is under "sub print_form" section on the above code.

can anyone tell me what is the mistake i have done. if the script has mejor error, then it doesn't work on Firefox.

any help or suggesstion will be highly appretiated.

Thanks!
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #2 (permalink)  
Old 05-17-07, 06:12 AM
Vicious's Avatar
Vicious Vicious is offline
Community VIP
 
Join Date: Jan 2007
Location: Belgium
Posts: 584
Thanks: 0
Thanked 0 Times in 0 Posts
try replacing this:
javascript Code:
  1. document.getElementById(container).innerHTML=descriptionarray[which.selectedIndex]
with
javascript Code:
  1. document.getElementById(container).value=descriptionarray[which.selectedIndex]

"value" instead of "innerhtml".

Haven't tested it, let me know if it works.

edit: if .value doesn't work, try .text
__________________
Jack Bauer makes Chuck Norris cry
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #3 (permalink)  
Old 05-18-07, 06:36 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Vicious!

Code:
 document.getElementById(container).value=descriptionarray[which.selectedIndex]
this has worked. greate

to do editon esiaer i have put a line break on the variable using CGI so that on textarea box it should look like nice. but after edition i not been able to remove blank line breake from that variable. do you have any idea, how to remove it?
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #4 (permalink)  
Old 05-18-07, 08:40 AM
Nico's Avatar
Nico Nico is offline
Community Leader
 
Join Date: Sep 2005
Location: Spain
Posts: 8,074
Thanks: 11
Thanked 88 Times in 83 Posts
javascript Code:
  1. value = value.replace(/[\r\n\s]+$/, '').replace(/^[\r\n\s]+/, '');

This would trim blank lines and spaces from the beginning and end of the string.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
  #5 (permalink)  
Old 05-21-07, 06:46 AM
sujata_ghosh sujata_ghosh is offline
Wannabe Coder
 
Join Date: May 2006
Posts: 181
Thanks: 0
Thanked 0 Times in 0 Posts
Thanks Nico,

my problem has solved. thanks a lot.
Digg this Post!Add Post to del.icio.usBookmark Post in TechnoratiShare on FacebookShare on Stumble UponShare on Twitter
Reply With Quote
Reply

Bookmarks


Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
my first script not working PHPNewb PHP 1 12-06-03 05:44 PM
can some help me to get this script working cabj1981 ASP 5 09-26-03 11:50 AM
Subprofile Script Not Working macj1326 PHP 0 09-08-03 10:16 PM
$Mailserver script not working ccompola The Lounge 0 08-08-03 07:06 PM
Popup script not working lorensr JavaScript 3 07-21-03 04:06 PM


All times are GMT -5. The time now is 10:54 AM.
vBulletin® Copyright ©2000 - 2012, Jelsoft Enterprises Ltd.