473,396 Members | 2,029 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.

NS does not accept linkname.click

<a id="hiddenLink1" name="hiddenLink1" href="page1.htm"
target="someTarget1" >1 </a>
<a id="hiddenLink2" name="hiddenLink2" href="page2.htm"
target="someTarget1" >2 </a>
<A href="javascript:donothing();"
onClick="hiddenLink1.click();setTimeout('hiddenLin k2.click()',2000);">open
two</A>

works in Opera and IE, but not in NS. In NS, it has no action at all.

I tried document.links['hiddenLink1'].click(); IE gave me error, object
document.link.hiddenLink1 can not be empty.

Jul 23 '05 #1
4 1615
nntp wrote:
<a id="hiddenLink1" name="hiddenLink1" href="page1.htm"
target="someTarget1" >1 </a>
<a id="hiddenLink2" name="hiddenLink2" href="page2.htm"
target="someTarget1" >2 </a>
<A href="javascript:donothing();"
onClick="hiddenLink1.click();setTimeout('hiddenLin k2.click()',2000);">open
two</A>
http://jibbering.com/faq/#FAQ4_24

works in Opera and IE, but not in NS. In NS, it has no action at all.


Did you check the Javascript Console? Tools>Web Development>Javascript
Console.

Error: hiddenLink1 is not defined.


--
Randy
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #2
Lee
nntp said:

<a id="hiddenLink1" name="hiddenLink1" href="page1.htm"
target="someTarget1" >1 </a>
<a id="hiddenLink2" name="hiddenLink2" href="page2.htm"
target="someTarget1" >2 </a>
<A href="javascript:donothing();"
onClick="hiddenLink1.click();setTimeout('hiddenLi nk2.click()',2000);">open
two</A>

works in Opera and IE, but not in NS. In NS, it has no action at all.
It has an action, but you need to open the Javascript console to see it.
It should display an error because there is no global variable named
"hiddenLink1". IE, and apparently Opera, allows you to get away with
that, but it's poor practice. To get a reference to an element with a
given id, use getElementById(), as in:

document.getElementById('hiddenLink1').click();

However, I don't think links have a "click()" method in Netscape.

You also shouldn't use the javascript: pseudo-protocol like that.
It may cause errors if Javascript is disabled.

<html>
<head>
<script type="text/javascript">
function openTwoWindows(url1,url2){
window.open(url1);
setTimeout("window.open('"+url2+"')",2000);
}
</script>
</head>
<body>
<a href="errorPage.html"
onclick="openTwoWindows('page1.htm','page2.htm');r eturn false"open two</a>

</body>
</html>

Jul 23 '05 #3
Do you know how I can do click in NS?

Here is the one with getelementbyid

<a id="hiddenLink1" name="hiddenLink1" href="http://www.google.com"
target="someTarget1" >1 </a>
<a id="hiddenLink2" name="hiddenLink2" href="http://www.yahoo.com"
target="someTarget1" >2 </a>
<SCRIPT language="JavaScript">
function donothing() {return ;}
</SCRIPT>

<A href="#" onClick="document.getElementById('hiddenLink1').cl ick();
setTimeout('document.getElementById(\'hiddenLink2\ ').click()',2000);">open
2</A>

Works in IE and Opera. STILL not working in NS. I guess it is the click()
not working in NS;

I need to pass the REFERRER into it, so I really need click(). Frames are
not an option.

Jul 23 '05 #4
nntp wrote:
<a id="hiddenLink1" name="hiddenLink1" href="page1.htm"
target="someTarget1" >1 </a>
<a id="hiddenLink2" name="hiddenLink2" href="page2.htm"
target="someTarget1" >2 </a>
<A href="javascript:donothing();"
onClick="hiddenLink1.click();setTimeout('hiddenLin k2.click()',2000);">open
two</A>

works in Opera and IE, but not in NS. In NS, it has no action at all.

I tried document.links['hiddenLink1'].click(); IE gave me error, object
document.link.hiddenLink1 can not be empty.


You don't need it to click the link. Try:

<A href="#"
onclick="
location = document.getElementById('hiddenLink1');

setTimeout('location=document.getElementById(\'hid denLink2\')',2000)
;">open 1</A>

Incidentally, the setTimeout will not work (I think)
because you navigate to the first link, so the page is
unloaded. You can't execute a script from a page that is
no longer in the browser (gee, wouldn't that really screw
with users's minds!! Isn't the unload function nasty
enough?)

Cheers, Rob
Jul 23 '05 #5

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

Similar topics

4
by: Craig831 | last post by:
First off, I apologize if this gets long. I'm simply trying to give you all enough information to help me out. I'm writing (almost finished, actually), my first VB.Net application. It's a forms...
14
by: Anoop | last post by:
Hi, I am new to this newsgroup and need help in the following questions. 1. I am workin' on a GUI application. Does C# provides Layout Managers the way Java does to design GUI? I know that it...
2
by: StanB | last post by:
I came across this weird problem: 1. Session state stops working after the app is deployed to another server because IE does not accept cookies. 2. It works if cookieless="true" in the...
3
by: brendanmcdonagh | last post by:
Hi all I have managed to suss out Sockets today and i have got a gui going with netbeans that sends text on button press to a serversocket on another computer. I receive the messages when i open...
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: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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:
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...
0
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...
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...
0
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...

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.