473,772 Members | 3,752 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

[Netscape] href in iframe hangs when calling function in parent window

Hi,

the following code has the mentioned behaviour:

<html>
<head>
<script type="text/javascript">
function newA() {
for (i=0;i<3;i++) {
var a = window.frames[0].document.creat eElement("a");
a.innerHTML = "anchor "+i;
a.setAttribute( "innerHTML" , "anchor "+i);
a.setAttribute( "href", "javascript:par ent.h_click()") ;
window.frames[0].document.body. appendChild(a);
}
}
function h_click() {
alert('ciao!');
}
</script>
</head>
<body>
<input type="button"
onclick="docume nt.body.appendC hild(document.c reateElement('i frame'))"
value="new iFrame">
<input type="button" onclick="newA() " value="new anchor">
</body>
</html>
The same stuff adapted to IE6 works.

Suggestions?

Thnx,

Christian

Jul 20 '05 #1
1 4346
Christian Radermacher wrote:
Hi,

the following code has the mentioned behaviour:

<html>
<head>
<script type="text/javascript">
function newA() {
for (i=0;i<3;i++) {
var a = window.frames[0].document.creat eElement("a");
a.innerHTML = "anchor "+i;
a.setAttribute( "innerHTML" , "anchor "+i);
a.setAttribute( "href", "javascript:par ent.h_click()") ;
window.frames[0].document.body. appendChild(a);
}
}
function h_click() {
alert('ciao!');
}
</script>
</head>
<body>
<input type="button"
onclick="docume nt.body.appendC hild(document.c reateElement('i frame'))"
value="new iFrame">
<input type="button" onclick="newA() " value="new anchor">
</body>
</html>

The same stuff adapted to IE6 works.

Suggestions?

Thnx,

Christian


<script type="text/javascript">
function newA() {
for (i=0;i<3;i++) {
var a = window.frames[0].document.creat eElement("a");
var t = window.frames[0].document.creat eTextNode("anch or" + i);
a.setAttribute( "href", "#");
a.onclick = parent.h_click;
a.appendChild(t );
window.frames[0].document.body. appendChild(a);
}
}
function h_click() {
alert('ciao!');
return false;
}
</script>

Works in Mozilla/5.0 (Windows; U; Windows NT 5.0; en-US; rv:1.5b)
Gecko/20030904

Note that you shouldn't be setting HREF to "javascript:... " <url:
http://jibbering.com/faq/#FAQ4_24 /> and you should be returning false
from the onclick event.

Oddly enough, the links don't appear with the correct text decoration in
the version of Mozilla I tested it in. Nor does the mouse cursor change
when I roll over them. However, when clicked, they do alert "ciao!".

--
| Grant Wagner <gw*****@agrico reunited.com>

* Client-side Javascript and Netscape 4 DOM Reference available at:
*
http://devedge.netscape.com/library/...ce/frames.html

* Internet Explorer DOM Reference available at:
*
http://msdn.microsoft.com/workshop/a...ence_entry.asp

* Netscape 6/7 DOM Reference available at:
* http://www.mozilla.org/docs/dom/domref/
* Tips for upgrading JavaScript for Netscape 7 / Mozilla
* http://www.mozilla.org/docs/web-deve...upgrade_2.html
Jul 20 '05 #2

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

Similar topics

5
11071
by: deko | last post by:
I'd like to use a bit of code in the OnOpen event of a report: =rptOpen(Me.ReportName), (Me.Tag) --this doesn't work This does work: Private Sub Report_Open(Cancel As Integer) modHandler.rptOpen (Me.Report.Name), (Me.Tag) End Sub
1
3616
by: Gregory Hassett | last post by:
Hi, I have a web service called GetComputerNameAndDescription which I can call from the main thread of my app. If I call it from a separate thread, however, it hangs on the call to Invoke() -- but only if I'm in the debugger. Here's a stack trace with non-user code shown -- the call to RegisterNotifySource, at the top of the stack, never returns -- I have to do a "break all" inside the debugger, then find this thread and examine its call...
0
904
by: Materialised | last post by:
Hi All, My program is hanging when I call a function for convert a image file to base64. I am wondering if I handled the call to this function within a different thread if it would make any difference. My function code is shown below: Public Function ImageToString(ByVal bImage As Bitmap) As String Try
4
1389
by: Peter Afonin | last post by:
Hello, I have a weirdest issue I've ever had. I have a function that enters some data into the Oracle table and returns the sequential row number for the new record (autonumber): Private Function AddSystem(ByVal txt As TextBox, ByVal cn As OracleConnection) As Integer Try
1
8112
by: kambakht | last post by:
I am using an iframe in my index.aspx thus all the webforms in application navigate in this iframe. While main appication links are present on the top of page above iframe, in main window. These links have target=myiFrame, thus opening respective pages in iFrame. I have put the session timeout period on each page so if some user remains inactive for 10 minutes (all webforms in iframe), he will be redirected to login.aspx page through...
2
1639
by: VBLearner | last post by:
How to close the parent and all child forms together at once when click on parent window's close button X?
4
10652
by: astri | last post by:
#include "Unit1.h" #include "math.h" #include "fixed_math.hpp" #include "algorithm.h" #define MBIT 0x4000 #define CBIT 16 long constbl; void __fastcall TForm1::Button1Click(TObject *Sender)
0
836
by: ngrTerry | last post by:
When I change from the code view to the design view of a form in Visual Studio 2005 (VB.NET) The design environment hangs for up to five minutes with a blank screen where the form should be. I have installed the latest service pack and upgraded to 2Gb RAM. I have a Centrino 1.9Ghz processor. The problem seems to have got worse lately. It appears that the designer hangs whilst the form is rebuilt from the designer code - or something...
0
9620
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
9454
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
10261
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...
0
10104
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10038
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
9912
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
8934
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...
1
7460
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5482
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?

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.