Onclick - Advice Please
Hi again forum revlers and helpfull kindly people alike.
I posted the other day regarding Onclick and the advice given was fine and worked (In browzer from a folder on my desktop).
However my project is in near completion, and the friendly and helpfull people of this forum have been fundimental in this goal.
Today i uploaded several of my .html
files onto a server.
The issue i have is with onclick, as far as i can see the server pathways have been changed correctly, when i click the links are dead.
It would be a great help if someone could look at my code and hopefully spot a simple error and maybe repost the code corrected with blah blahs.
Here is my code:
<a href="http://www.blahblah.co.uk/directory/#" onClick="window.open('cutedoglarge.jpg','','width=347,height=440,status=0,scrollbars=0','screenx=300','screeny=200')"><img src="http://www.blahblah.co.uk/directory/cutedogthumb" alt="Click To Enlarge" width="154" height="200" class="thumb" border="0" style="display:inline"></a>
Any help would be appreciated
Thanks in advance.
decibel.places posted this at 02:40 — 15th November 2008.
He has: 1,494 posts
Joined: Jun 2008
I don't think this a fatal error, but usually for this type of dummy link I use the JavaScript void() function:
<a href="javascript: void(0)"
which does not reposition the page like the "#" usually does.
actually, when I do see the hash used, it is usually solo like
<a href="#"
but I would definitely go with the void() function.
You may need to put in the full URL to the image, if you are having problems...
Kim01 posted this at 09:09 — 15th November 2008.
They have: 15 posts
Joined: Nov 2008
After googleing the
<a href="javascript: void(0)"
there was a lot of talk about it having a bug ect so i was a little dubious.But i have to say it works perfectly in both firefox and IE and my page doesnt reload! Perfect thank you Decibel, very kind.
JeevesBond posted this at 04:06 — 17th November 2008.
He has: 3,956 posts
Joined: Jun 2002
Not sure if this is still a problem (and what the exact issue was in the first place! ), but you could re-write your code like this:
<a href="#" onClick="window.open('cutedoglarge.jpg','','width=347,height=440,status=0,scrollbars=0','screenx=300','screeny=200');return false;"><img src="http://www.blahblah.co.uk/directory/cutedogthumb.jpg" alt="Click To Enlarge" width="154" height="200" class="thumb" border="0" style="display:inline"></a>
Hope this helps.
*** EDIT ***
Don't be afraid to post a link, it's often easier to see what a problem is by looking at a live page.
a Padded Cell our articles site!
Want to join the discussion? Create an account or log in if you already have one. Joining is fast, free and painless! We’ll even whisk you back here when you’ve finished.