473,804 Members | 3,113 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Using a # in a dummy onclick plus page reload

Hi friends and neighbours! Gotta problem, maybe you can help...

I'm using a dummy # reference in an href so I can use the onclick
event. This works well.

The problem comes when a user hits the browser's reload button...the
Address Bar now reads http://mydomain//mypage.html#, and this produces
weird javascript errors on line 1. I tried adding a phony href (<a
href="#" onclick="window .location.reloa d(true)"></a>) to refresh, but
obviously the click event isn't being fired when the browser's reload
button is hit. Can anyone suggest an alternative?

Tyler
tyler...AT...(h ealthyhabitsweb ) dot [com]

Jun 1 '06 #1
3 1842
VK

Logos wrote:
I'm using a dummy # reference in an href so I can use the onclick
event.
<http://www.javascriptt oolbox.com/bestpractices/new.php#onclick >
Can anyone suggest an alternative?


See above.

Jun 1 '06 #2

VK wrote:
Logos wrote:
I'm using a dummy # reference in an href so I can use the onclick
event.


<http://www.javascriptt oolbox.com/bestpractices/new.php#onclick >
Can anyone suggest an alternative?


See above.


Thanks!!! You are my hero! Plus the site has oodles of other good
schtuff - extra scooby snack for you!

Tyler

Jun 1 '06 #3
VK

Logos wrote:
VK wrote:
<http://www.javascriptt oolbox.com/bestpractices/new.php#onclick >


Thanks!!! You are my hero! Plus the site has oodles of other good
schtuff - extra scooby snack for you!


You may want to forward your thanks to Matt Kruse who prepared and keep
updating this source: see also "Updated Javascript Best Practices
document" thread in this newsgroup.

Jun 2 '06 #4

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

Similar topics

14
1876
by: Dafydd | last post by:
I have the following Script in my web page reduce to two pages. <script> function details() { document.getElementById('details').style.visibility='visible'; document.getElementById('capabilities').style.visibility='hidden'; } function capabilities() {
7
3001
by: johkar | last post by:
I am confused on childNodes or children. When you have nested lists, I would think it would all be one list in the Dom, this doesn't seem to be the case. So how do you traverse an unordered list? Any help appreciated. John In the below script, I can expand and contract the nodes when clicked on, but I want the menu to close all other siblings to the node clicked so that only one sub menu option is expanded at one time. If the node...
24
3270
by: jonathon | last post by:
Hi all, I have a web app with a popup window for entering data. I don't want to access the web every time this window is opened, as most of the app is AJAX. But I can't figure out how to open a new window and build it with DOM rather than having to provide a src. Even a blank.html as src takes time to fetch. How can I create a popup and dynamically add DOM content without any html at all?
8
2241
by: PJ6 | last post by:
I'm having a problem I can't reproduce in a simple example. If I create a class that inherits button and click on it in a web page, if I override the OnClick method, on clicking, any code is executed, and any breakpoints within it are hit. This exepcted behavior works in simple test projects under a lot of different conditions. OK so I put the exact same button inheritor in the live project that I'm working on, and... the overriden...
35
2463
by: Logos | last post by:
I asked about this a while ago, and got a great answer and a reference to http://www.javascripttoolbox.com/bestpractices/new.php. I just need to override onclick and return false. No biggie! However, I discovered that my code worked fine in IE (no # in URL after click), but not in FF (# appears in URL after click). Can anyone tell me why? if(link.attachEvent) { eval("link.attachEvent('onclick',function() { GB_show('" +part.strDesc...
8
2393
by: dbaplusplus | last post by:
I worked on web development using java script many many years, so I am now a newbie to javascript. I have a single html page, which is generated dynamically using some programming language. Web page will be viewed using Microsoft's IE browser (version 6.x ....). Webapge is self-contained. i.e., it does not refer to any links outside the webpage, however, it uses bookmarks inside the same page. I have a long table to display, table has...
2
2824
by: prophet | last post by:
how do I create a print button that is on my index page that prints my target page (and only the target page) I tried <INPUT onclick=window.print(); type=button value="Print This Page" style="font-size: 10px; float:right"> But it prints the index page. Thank you.
1
2859
by: garey | last post by:
Hello - I have written a small table of contents manager. If an entry has sub-entries, it has a plus in front of it. If the user clicks on the plus, the sub-entries are displayed. The table of contents is displayed in one frame and the pages of the document in the other. Clicking on a table of contents entry redraws the image in the page frame. In order to implement this I have the following structure
0
1032
by: cbarnese | last post by:
I am trying to control a web page that has an expansion box named "signContact", clicking on this expansion box unhides additional form details. I want to achieve the same as clicking on this box from my VB script Below is the section of Java script behind the webpage I am working with - i.e. the expansion box (plus.gif) and the method I wish to activate - "toggleDiv(spContact)" <tr> <td width="9" class="SubSectHeading"><img...
0
10578
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
10321
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
10077
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
9152
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
7620
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
5522
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...
0
5651
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4300
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
2
3820
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.