473,806 Members | 2,929 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Works in Firefox, but not in IE

Please help,

My class assignment is due today and I am all finished except for one
small portion.

The instructor wants us to import a script from somewhere else, and for
some reason I deceided to make it more complicated than it needs to be.

What I am trying to do is create a popup when the user leaves the page
( I know pop-ups are bad, but they are a part of the course) that
displays the imported script. It works perfectly in firefox, but IE
displays everything except the script.

I am a total loss at why, hopefully someone can shed some light on this
for me:

(the closeWin() is called from the body tag using
onUnload="close Win()")

// Import a script from somewhere else.
function closeWin() {
closeWindow = window.open("", "closeWin",
"toolbar=no,res izable=no,width =500,height=225 ,scrollbar=no,l eft=250,top=200 ")
closeWindow.doc ument.write("<h tml><head><titl e>An Imported
Script<\/title><\/head><body><tab le align='center'> <tr><td colspan='2'
align='center'> <p>The following is an imported script<\/p><script
src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script><p
align='center'> <font face='arial' size='-2'>This free script provided
by<\/font><br><font face='arial, helvetica' size='-2'><a
href='http://javascriptkit.c om'>JavaScript
Kit</a><\/font><\/p><\/td><\/tr><\/table><\/body><\/html>")
}

function importedScript( ) {
//Roller Coaster Script - By JavaScriptKit Over 200+ free scripts
here!

var fs=1
var direction="righ t"
function rollertext(whic hone){
var thetext=whichon e
for (i=0;i<thetext. length;i++){
document.write( thetext.charAt( i).fontsize(fs) )

if (fs<7&&directio n=="right")
fs++
else if (fs==7){
direction="left "
fs--
}
else if (fs==1){
direction="righ t"
fs++
}
else if (fs>1&&directio n=="left")
fs--

}
}
//Change below text to your won
rollertext("Lif e is like a roller coaster ride. Hang on tight!")
}

Jun 14 '06 #1
12 1567
I have a very rudimentary knowledge of JavaScript (I'm more of a Java
guy myself), but where you had written:

<script src='external.j s' language='JavaS cript'
type='text/javascript'>

The file "external.j s", is that where the imported script should be
stored? Rather than along with this code?

Also, and this might be due to formatting reasons when you posted this
code, but the comment that shows up immediately after the
importedScript( ) function is a single line comment, but it looks like
it's split along two lines....leavin g "here!" on a line by itself,
which could be causing the code to break.

I'm sure you'll get some people smarter than me to repsond to this, but
I just wanted to throw my two cents in.
CalgaryWebGuy wrote:
Please help,

My class assignment is due today and I am all finished except for one
small portion.

The instructor wants us to import a script from somewhere else, and for
some reason I deceided to make it more complicated than it needs to be.

What I am trying to do is create a popup when the user leaves the page
( I know pop-ups are bad, but they are a part of the course) that
displays the imported script. It works perfectly in firefox, but IE
displays everything except the script.

I am a total loss at why, hopefully someone can shed some light on this
for me:

(the closeWin() is called from the body tag using
onUnload="close Win()")

// Import a script from somewhere else.
function closeWin() {
closeWindow = window.open("", "closeWin",
"toolbar=no,res izable=no,width =500,height=225 ,scrollbar=no,l eft=250,top=200 ")
closeWindow.doc ument.write("<h tml><head><titl e>An Imported
Script<\/title><\/head><body><tab le align='center'> <tr><td colspan='2'
align='center'> <p>The following is an imported script<\/p><script
src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script><p
align='center'> <font face='arial' size='-2'>This free script provided
by<\/font><br><font face='arial, helvetica' size='-2'><a
href='http://javascriptkit.c om'>JavaScript
Kit</a><\/font><\/p><\/td><\/tr><\/table><\/body><\/html>")
}

function importedScript( ) {
//Roller Coaster Script - By JavaScriptKit Over 200+ free scripts
here!

var fs=1
var direction="righ t"
function rollertext(whic hone){
var thetext=whichon e
for (i=0;i<thetext. length;i++){
document.write( thetext.charAt( i).fontsize(fs) )

if (fs<7&&directio n=="right")
fs++
else if (fs==7){
direction="left "
fs--
}
else if (fs==1){
direction="righ t"
fs++
}
else if (fs>1&&directio n=="left")
fs--

}
}
//Change below text to your won
rollertext("Lif e is like a roller coaster ride. Hang on tight!")
}


Jun 14 '06 #2
Thanks for the response,

The imported script is stored in the .js file, and so is the script
that is writing the page 'on the fly' so, it is refrencing itself in a
round about way. But as far as I am aware, this should work, as when it
calls the script, it's a new page entirely that is created by the
closeWin() function. If that makes any sense.

The formating issue is due to how this message is posted, and is coded
properly.
Robert Iver wrote:
I have a very rudimentary knowledge of JavaScript (I'm more of a Java
guy myself), but where you had written:

<script src='external.j s' language='JavaS cript'
type='text/javascript'>

The file "external.j s", is that where the imported script should be
stored? Rather than along with this code?

Also, and this might be due to formatting reasons when you posted this
code, but the comment that shows up immediately after the
importedScript( ) function is a single line comment, but it looks like
it's split along two lines....leavin g "here!" on a line by itself,
which could be causing the code to break.

I'm sure you'll get some people smarter than me to repsond to this, but
I just wanted to throw my two cents in.
CalgaryWebGuy wrote:
Please help,

My class assignment is due today and I am all finished except for one
small portion.

The instructor wants us to import a script from somewhere else, and for
some reason I deceided to make it more complicated than it needs to be.

What I am trying to do is create a popup when the user leaves the page
( I know pop-ups are bad, but they are a part of the course) that
displays the imported script. It works perfectly in firefox, but IE
displays everything except the script.

I am a total loss at why, hopefully someone can shed some light on this
for me:

(the closeWin() is called from the body tag using
onUnload="close Win()")

// Import a script from somewhere else.
function closeWin() {
closeWindow = window.open("", "closeWin",
"toolbar=no,res izable=no,width =500,height=225 ,scrollbar=no,l eft=250,top=200 ")
closeWindow.doc ument.write("<h tml><head><titl e>An Imported
Script<\/title><\/head><body><tab le align='center'> <tr><td colspan='2'
align='center'> <p>The following is an imported script<\/p><script
src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script><p
align='center'> <font face='arial' size='-2'>This free script provided
by<\/font><br><font face='arial, helvetica' size='-2'><a
href='http://javascriptkit.c om'>JavaScript
Kit</a><\/font><\/p><\/td><\/tr><\/table><\/body><\/html>")
}

function importedScript( ) {
//Roller Coaster Script - By JavaScriptKit Over 200+ free scripts
here!

var fs=1
var direction="righ t"
function rollertext(whic hone){
var thetext=whichon e
for (i=0;i<thetext. length;i++){
document.write( thetext.charAt( i).fontsize(fs) )

if (fs<7&&directio n=="right")
fs++
else if (fs==7){
direction="left "
fs--
}
else if (fs==1){
direction="righ t"
fs++
}
else if (fs>1&&directio n=="left")
fs--

}
}
//Change below text to your won
rollertext("Lif e is like a roller coaster ride. Hang on tight!")
}


Jun 14 '06 #3

CalgaryWebGuy wrote:
<script src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script>


In the line above, you are importing a script and attempting to execute
statements. That is incorrect. Referencing an external script and
execution of statements within the script tags should be kept separate
like so:

<script src = "external.j s" type = "text/javascript"></script>
<script type = "text/javascript">
importedScript( );
</script>

Format the above solution into your assignment.
Don't assume FF is the absolute browser of choice for javascript. In
this case, IE was doing it correctly.

Jun 14 '06 #4
CalgaryWebGuy said the following on 6/14/2006 10:22 AM:
Please help,

My class assignment is due today and I am all finished except for one
small portion.

The instructor wants us to import a script from somewhere else, and for
some reason I deceided to make it more complicated than it needs to be.

What I am trying to do is create a popup when the user leaves the page
( I know pop-ups are bad, but they are a part of the course) that
displays the imported script. It works perfectly in firefox, but IE
displays everything except the script.

I am a total loss at why, hopefully someone can shed some light on this
for me:

(the closeWin() is called from the body tag using
onUnload="close Win()")

// Import a script from somewhere else.
function closeWin() {
closeWindow = window.open("", "closeWin",
"toolbar=no,res izable=no,width =500,height=225 ,scrollbar=no,l eft=250,top=200 ")
closeWindow.doc ument.write("<h tml><head><titl e>An Imported
Script<\/title><\/head><body><tab le align='center'> <tr><td colspan='2'
align='center'> <p>The following is an imported script<\/p><script
src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script>


If Firefox is executing that importedScript( ) call then FF is the one
that is dead wrong here.

This is what you script tag looks like (formatted)

<script src='external.j s' type='text/javascript'> importedScript( )
<\/script>

The function call should never be executed if it has a src attribute.

To "fix" it, add a second script block that makes the call:

<script src='external.j s' type='text/javascript'></script>
<script type='text/javascript'> importedScript( )</script>
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 14 '06 #5
That's the fix!!

Thanks Randy & Web.Dev!!

Randy Webb wrote:
CalgaryWebGuy said the following on 6/14/2006 10:22 AM:
Please help,

My class assignment is due today and I am all finished except for one
small portion.

The instructor wants us to import a script from somewhere else, and for
some reason I deceided to make it more complicated than it needs to be.

What I am trying to do is create a popup when the user leaves the page
( I know pop-ups are bad, but they are a part of the course) that
displays the imported script. It works perfectly in firefox, but IE
displays everything except the script.

I am a total loss at why, hopefully someone can shed some light on this
for me:

(the closeWin() is called from the body tag using
onUnload="close Win()")

// Import a script from somewhere else.
function closeWin() {
closeWindow = window.open("", "closeWin",
"toolbar=no,res izable=no,width =500,height=225 ,scrollbar=no,l eft=250,top=200 ")
closeWindow.doc ument.write("<h tml><head><titl e>An Imported
Script<\/title><\/head><body><tab le align='center'> <tr><td colspan='2'
align='center'> <p>The following is an imported script<\/p><script
src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script>


If Firefox is executing that importedScript( ) call then FF is the one
that is dead wrong here.

This is what you script tag looks like (formatted)

<script src='external.j s' type='text/javascript'> importedScript( )
<\/script>

The function call should never be executed if it has a src attribute.

To "fix" it, add a second script block that makes the call:

<script src='external.j s' type='text/javascript'></script>
<script type='text/javascript'> importedScript( )</script>
--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Jun 14 '06 #6
I agree I probably shouldn't use FF as a default browser when editing..
I just have such a prejudice against Microsoft that I automatically use
FF instead. Old habits are hard to break!

Thanks again!
web.dev wrote:
CalgaryWebGuy wrote:
<script src='external.j s' language='JavaS cript'
type='text/javascript'>imp ortedScript()<\/script>


In the line above, you are importing a script and attempting to execute
statements. That is incorrect. Referencing an external script and
execution of statements within the script tags should be kept separate
like so:

<script src = "external.j s" type = "text/javascript"></script>
<script type = "text/javascript">
importedScript( );
</script>

Format the above solution into your assignment.
Don't assume FF is the absolute browser of choice for javascript. In
this case, IE was doing it correctly.


Jun 14 '06 #7
CalgaryWebGuy said the following on 6/14/2006 2:11 PM:
I agree I probably shouldn't use FF as a default browser when editing..
Nobody said that. What was said was not to believe that FF is always
right - it isn't.
I just have such a prejudice against Microsoft that I automatically use
FF instead. Old habits are hard to break!


Is top posting such an old habit that you can't break it?

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 14 '06 #8

Randy Webb wrote:
CalgaryWebGuy said the following on 6/14/2006 2:11 PM:
I agree I probably shouldn't use FF as a default browser when editing..
Nobody said that. What was said was not to believe that FF is always
right - it isn't.


My point was that the majority of internet users still use IE, so
testing should probably be done in IE, and then checked in the other
browsers for compatability. I never indicacted that I believe that FF
is always right, it's simply not a microsoft product, which gives it a
huge bonus in my books.
I just have such a prejudice against Microsoft that I automatically use
FF instead. Old habits are hard to break!


Is top posting such an old habit that you can't break it?

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Sorry for the offensive top posting. I know people have different
posting prefrences, and it does cause the conversation to break apart.
But emailing is generally always done using top posting, so to answer
your question, yes it is a hard habit to break. Especially for those of
us who only sparesly participate in newsgroupts.

Google Groups is smart enough to hide the quoted text, but I guess I
just wasn't thinking about the fact that people use different readers.

Now if I were to answer emails at work, in the fashion that I just
responded to this message, I know I would get the response "Why did you
send me back my email without answering?"

So, either one of two things need to happen,

1) Everyone adopt the top posting method, as whether people like it or
not, it is the norm in emails and likely will be in newsgroups down the
road.

2) Educate everyone who uses a computer to post properly.

Which do you think is more likely to be succesfull?

Another question, why do newsgroup posts nearly always end up as off
topic arguments?

Jun 14 '06 #9
CalgaryWebGuy said the following on 6/14/2006 7:31 PM:
Randy Webb wrote:
CalgaryWebGuy said the following on 6/14/2006 2:11 PM:
I agree I probably shouldn't use FF as a default browser when editing.. Nobody said that. What was said was not to believe that FF is always
right - it isn't.


My point was that the majority of internet users still use IE,


True. Sad but true.
so testing should probably be done in IE, and then checked in the other
browsers for compatability.
I typically do it the other way around but you have a point.
I never indicacted that I believe that FF is always right, it's simply
not a microsoft product, which gives it a huge bonus in my books.
I just have such a prejudice against Microsoft that I automatically use
FF instead. Old habits are hard to break! Is top posting such an old habit that you can't break it?

Answer:It destroys the order of the conversation
Question: Why?
Answer: Top-Posting.
Question: Whats the most annoying thing on Usenet?

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/


Sorry for the offensive top posting. I know people have different
posting prefrences, and it does cause the conversation to break apart.
But emailing is generally always done using top posting, so to answer
your question, yes it is a hard habit to break. Especially for those of
us who only sparesly participate in newsgroupts.


I very seldom see top-posted emails. The only time they get "reversed"
is when they are forwarded. But that may just be me <shrug>
Google Groups is smart enough to hide the quoted text, but I guess I
just wasn't thinking about the fact that people use different readers.
Its more about a convention in this group than different readers. There
are some groups that prefer top posting, some prefer bottom posting.
Still others prefer inter-leaved posting (as this one and yours was).
Now if I were to answer emails at work, in the fashion that I just
responded to this message, I know I would get the response "Why did you
send me back my email without answering?"
My first thought about that was "This is Usenet, not email" but then
after thinking about it, it falls into the same category as top-posting
at all. It depends on the convention used. And in my own experience, I
do not see a lot of top-posted emails.
So, either one of two things need to happen,

1) Everyone adopt the top posting method, as whether people like it or
not, it is the norm in emails and likely will be in newsgroups down the
road.
That I disagree with. It is up to each group to adopt a convention and
this group has adopted inter-leaved posting as the preferred method of
posting.
2) Educate everyone who uses a computer to post properly.
Ummm, ok :)
Which do you think is more likely to be succesfull?
Probably neither :)
Another question, why do newsgroup posts nearly always end up as off
topic arguments?


Such is the nature of Usenet I suppose. But it is not an "argument", per
se, to me as much as it is a conversation about the posting conventions
used in this group.

--
Randy
comp.lang.javas cript FAQ - http://jibbering.com/faq & newsgroup weekly
Javascript Best Practices - http://www.JavascriptToolbox.com/bestpractices/
Jun 15 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

14
5500
by: tshad | last post by:
I posted this on the asp.net group, also. I wasn't sure whether this was an asp.net problem or a javascript problem. I have a page that was originally created from a program I found on the net that works well as an html page. It brings up a modal popup window that I have been trying to work out for days now and this was the closest I have been able to come. I added a little asp.net code and an asp.net button and cannot get it to
5
31228
by: Derek Erb | last post by:
I am banging my head against the wall with this one. The following code snippets work perfectly fine in MSIE6. But produce an error in Firefox and do not work at all. BROWSER.HTM <HTML> .... <div class="Abb"> <h2 id="ABTit">BROWSER</h2> </div>
11
2368
by: lkrubner | last post by:
We are working on a website that is here: http://www.lauradenyes.com/ The site was working till I put up an .htaccess file that was suppose to redirect all html files to the PHP parser. The site then stopped working, because I had the address of the PHP parser wrong. I then deleted the .htaccess file, and the site began to work again. However, on one machine it still does not work in FireFox.
14
24244
by: David Blickstein | last post by:
I have some XML documents that I want to open in a web browser and be automatically translated to HTML via XSLT. I'm using an xml-stylesheet processing command in a file called "girml.xml". This all works in Internet Explorer, but doesn't work with Firefox. In both IE and Firefox this works: <?xml-stylesheet type="text/xsl" encoding="UTF-8" href="makehtml.xslt" version="1.0"?>
3
3397
by: KBuser | last post by:
I recently developed an internal website with various queries against our SQL server. I added buttons with Response.Redirect. These buttons do not work with Internet Explorer, however when using Firefox the page works flawless. Does anyone know why this is happening or how to fix it?
4
2304
by: puja | last post by:
hi all, I have an asp.net website where am including .css file dynamically on page load event. For diff users, there is diff CSS file. So after user logs in, I am setting CSS href on page load. My CSS file works fine in IE 6.0 when i specify the absolute path. eg- href ="D:\Mywebsite\css\mycssfile.css" but this full path does not work in firefox 1.5.0.5. When I load page in firefox, css file seems to have no effect on page. If I...
28
13210
by: entfred | last post by:
I have the following line of html: &nbsp;&nbsp1234&nbsp;&nbsp;&nbsp;&nbsp;&nbspabc&nbsp;&nbsp;&nbspyow In Internet Explorer 6.0, the columns look ok using the above html: 1234 abcd yow But, in firefox, for same html, getting this:
3
1766
by: Arodicus | last post by:
I have a static class method, MyObject.MySub.MyMethod(), which points to a handler in a Flash SWF (but I think that's inconsequential). In reality, the path is a lot longer, so I'd like to make a simpler way for other programmers to access that method, such as this: var MyFunc = MyObject.MySub.MyMethod So they could just call MyFunc() instead. This "proxy" or "shorthand" works great in IE, but fails in Firefox/Safari and sometimes even...
13
3750
by: Stever1975 | last post by:
I'm working on something similiar to a shopping cart item page. There is a table of items. Each item has an image, a textbox for the qty and an image for the add button. When the add image is clicked it adds the item to the cart array and sums it if the item already exists in the cart. This code works perfectly fine in Internet explorer and firefox, heck I even tested it in chrome and it works. So everything works fine in all browsers...
0
9719
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9597
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10620
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
10372
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10110
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
9187
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5546
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4329
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
3008
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.