HTML Tutorial


 Forum HomeForum Home   FAQFAQ   SearchSearch   MemberlistMemberlist   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 
RegisterRegister - Not registered yet? Got something to say? Join HTML Code Tutorial!
JavaScript in Firefox vs. Internet Explorer issue
Post new topic   Reply to topic    HTML Help Forum Index -> Javascript
View previous topic :: View next topic  
Author Message
pmcginty



Joined: 12 May 2008
Posts: 2

PostPosted: Mon May 12, 2008 8:18 am     JavaScript in Firefox vs. Internet Explorer issue Reply with quote

Hello.

I am having a major issue with a website I am working on that uses JavaScript to open a new window with specific height and width parameters. While it seems to work fine with Firefox, it does not work right at all with IE. Here is a link to one of the pages associated with the problem: http://www.chem.vt.edu/chem-dept/mcgrath/haeseung.htm Here is the code that I use:
Code:
<script language="JavaScript">
function figurewindow(txt)
{
   if(txt === "fig1")
   {
      window.open('Images/hleefig1.gif','H. Lee Figure 1','width=460,height=225');
   }
   else
   {
      window.open('Images/hleefig2.gif','H. Lee Figure 2','width=185,height=315');
   }
}
</script>


Here is the code for the links:

Code:
<a href="javascript:figurewindow('fig1')">here</a>


I have other examples for one image and three images, but they are all based on the same logic and coding syntax. I am sure that I am not the only one with this kind of problem, but is there a relatively simple solution to make this code compliant over all (at least most) web browers? Thanks for any help.
Straystudio



Joined: 14 Apr 2008
Posts: 255
Location: Nord Italy

PostPosted: Mon May 12, 2008 7:48 pm     No empty space nor most punctuations in naming pop-up Reply with quote

Same with me, IExplorer 7.
Get rid of either empty spaces and "dot" in naming pop-ups; do:

HLeeFigure1

or:

H_Lee_Figure_2



I would call this as an improvement as well, since it calls-back pop-ups from "keeping sitting", when You click the links again, using .focus():


Code:


<script language="JavaScript">
function figurewindow(txt)
{
   if (txt === "fig1")
   {
      one=window.open('http://www.chem.vt.edu/chem-dept/mcgrath/Images/hleefig1.gif', 'HLeeFigure1', 'width=460,height=225');
                one.focus();
   }
   else
   {
      two=window.open('http://www.chem.vt.edu/chem-dept/mcgrath/Images/hleefig2.gif', 'H_Lee_Figure_2', 'width=185,height=315');
                two.focus();
   }
}
</script>



Added complete URL just for testing purposes.
Wishes from Italy
pmcginty



Joined: 12 May 2008
Posts: 2

PostPosted: Tue May 13, 2008 7:40 am     Thank You! Reply with quote

If I learned anything about computer programming, it's that the little things usually cause the biggest problems. Besides HTML, I've programmed in Java and C++, but I am still a neophyte with Javascript. Thank you very much for spotting and reporting my coding error! Very Happy
Display posts from previous:   
Post new topic   Reply to topic    HTML Help Forum Index -> Javascript All times are GMT - 8 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum
HTML Help Archive
Powered by phpBB © 2001, 2005 phpBB Group
HTML Help topic RSS feed 

 
HOSTING / DESIGN
MAKE MONEY

Home
  |   Tutorials   |   Forum   |   Quick List   |   Link Directory   |   About
Copyright ©1997-2002 Idocs and ©2002-2007 HTML Code Tutorial