 |
|
|
| View previous topic :: View next topic |
| Author |
Message |
pmcginty
Joined: 12 May 2008 Posts: 2
|
Posted: Mon May 12, 2008 8:18 am JavaScript in Firefox vs. Internet Explorer issue |
|
|
|
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
|
Posted: Mon May 12, 2008 7:48 pm No empty space nor most punctuations in naming pop-up |
|
|
|
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
|
Posted: Tue May 13, 2008 7:40 am Thank You! |
|
|
|
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!  |
|
|
|
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
|
|
|
|
|
 |
|
|
|
|
|
|
|