473,396 Members | 1,989 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,396 software developers and data experts.

Frames using javascripts to open external sites cause problems in IE (not Netscape)

We have an application that contains links that run javascripts to
create pages in a separate frame. When these links open an external
site, it causes the javascripts to no longer function. When we
modified the links that invoke the javascripts from:
<a href=javascript: top.doSomething> text </a>
To:
<span onclick=javascript:top.doSomething> text </span>
The javascripts worked properly. Any ideas on why this now works or
other solutions? This site works fine when viewed using Netscape
4.76.
Jul 20 '05 #1
2 2367
In article <b9**************************@posting.google.com >,
sd*********@cizer.com (sdvoranchik) writes:
We have an application that contains links that run javascripts to
create pages in a separate frame. When these links open an external
site, it causes the javascripts to no longer function. When we
modified the links that invoke the javascripts from:
<a href=javascript: top.doSomething> text </a>
http://www.jibbering.com/faq/#FAQ4_24
To:
<span onclick=javascript:top.doSomething> text </span>
The javascripts worked properly. Any ideas on why this now works or
other solutions? This site works fine when viewed using Netscape
4.76.


NN4 supports onclick on a span?

<span onclick="alert('I support onclick in a span')">Test</span> gives no alert
in NN4.77, so what "works fine"? And it depends on your definition of "works
fine".
--
Randy
Jul 20 '05 #2
sdvoranchik wrote:
We have an application that contains links that run javascripts to
create pages in a separate frame. When these links open an external
site, it causes the javascripts to no longer function.
"Does not work" is a useless error description. [psf 4.11]

You have had a look into the JavaScript Console and/or enabled
the display of script errors before posting, have you not?
When we modified the links that invoke the javascripts from:
<a href=javascript: top.doSomething> text </a>
You have been misusing the "javascript:" URI scheme. It is designed
to generate (HTML) content from evaluated values, not to run code that
does not do so. It is likely that, if top.doSomething is a method,
a temporary document will be created with the return value of
top.doSomething(...) as its content or with the definition string of
top.doSomething(...) if you leave the call operator's parantheses out.
If it is a non-function property, that document should contain its value.

Since a URI is expected, you are not allowed to use unescaped spaces and
special characters within it, so if you did, it explains why it did not
work.
To:
<span onclick=javascript:top.doSomething> text </span>


Since "javascript:" is a URI scheme, it does not belong into intrinsic
event handlers' attribute values. Only Internet Explorer considers
"javascript:" to be a semantical label defining the scripting language
for that handler, other UAs will either consider it a label with no
meaning and ignore it because there is no jump statement to refer to it,
or show a script error if that language construct is unsupported for
some reason. And (X)HTML attribute values need to be delimited by
single or double quotes, if they are not only composed of a small subset
of characters, so write

<span onclick="top.doSomething">text</span>

instead (use ' within the script code if you need string delimiters) and
declare the default scripting language for event handlers within the
HEAD element:

<meta http-equiv="Content-Script-Type" content="text/javascript">

What about users without support for client-side scripting?
PointedEars
Jul 20 '05 #3

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

Similar topics

26
by: jj | last post by:
Care to enlight? Thanks!
40
by: JohnnyCJohnny | last post by:
Is it pretty safe to say that almost all web surfers now use browsers that are Frames compatible? What are most people using these days? IE? Thanks
34
by: s c o t t | last post by:
I know Jakob Neilsen and a bunch of other usability advocates and critics usually frown on usage frames. However, most people probably seem to have at least version 5 of IE or newer and I am...
4
by: Laphan | last post by:
Hi All I know the first thing that some might say is that I shouldn't be using in frames in web sites, but they are listed as being part of the HTML 4.0 standard. I am trying to do my web...
4
by: Tammy | last post by:
At the website http://www.htmlhelp.com/faq/html/frames.html#frame-update2 I found the following: The JavaScript-based solution uses the onClick attribute of the link to perform the secondary...
2
by: Kailas | last post by:
Hi All, I have a web page which has links to external sites. When user clicks on the external link, I want to display a banner on the top the window (5% of the window, to display link to take...
1
by: les | last post by:
Hello, I just wonder what are the implications to use frames to build portal. I've seen some sites that are quite fast with frames but I just wonder if there are hidden "costs". I've tried to...
20
by: M.Siler | last post by:
Let me first by saying I am NOT a .net programmer, but am very skilled with ASP, JavaScript, HTML, DHTML, Flash development. I've been reading through posts here about Frames vs. Master Pages and...
56
by: Deepan HTML | last post by:
Hi All, Currently i am working in a framed environment where i have divided the window as 20% and 80% and the 20% is used for navigation purpose and right frame for displaying the orignal content....
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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,...
0
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...
0
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...

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.