Javascript Help Needed
- Started
- Last post
- 19 Responses
- mattyd
anyone know a line of code that will stop the page from moving to the top when you click on the numbers at the middle/bottom of the page?
any help you can give would be appreciated. thanks in advance.
love,
- lvl_130
works fine for me dude. osx ie
- SteveJobs0
yeah, take out the '#'
- mattyd0
see, it works fine for me on osx safari, but not for anyone on windows os and some people on osx. which is odd.
- mattyd0
what do i put in its place? anything?
- lvl_130
ah, i see what you mean. just leave it blank
- SteveJobs0
why are they there in the first place? what is the hyperlink *going* to do? open the link in a new win?
- mattyd0
ah, good point. let me try it. thanks for the help by the way fellas. much appreciated.
- mattyd0
okay, i took of the '#' on the beckham piece and now it just refreshes the page
- SteveJobs0
yes, because now you have a link pointing to the page you're on -
what are you wanting the hyperlinks to do?
- elgatomalo0
Move the javascript calls to the href instead of the onclick. So instead of
a href="#" class="images" OnClick="b.src='tterror2.jpg';"
it should be
a href="javascript:b.src='tterror2... class="images"
- shaft0
put
javascript:void();
or
javascript:;
- shaft0
I'd rather put
a href="javascript:;" class="images" onClick="b.src='tterror2.jpg';"
..but I really don't remember why calling JS from onClick was better.
- snarlen0
you could also try doing onclick="return false;"
- bcoden0
Javascript: void(0); is what you need, When teh user clicks on teh link nothing will happen as well this command is cross browser friendly, then you can add onClick event to the link.
- elgatomalo0
OnClick is a trackable event in js while href is more difficult to keep tabs on. Both ways will work, but your way is definitely more js compliant (forgive the oxymoron).
- mattyd0
i put in both your codes, neither seemed to work. the beckham one just goes to another page and i added the code to 03 on brooklyn and that just comes up empty.
- mattyd0
it doesnt work on windows IE that is.
- shaft0
PVN likes to add random whitespace, the code won't work if you copied it without fixing those. That's all that comes to my mind, otherwise it should work ok.
- jarredbishop0
use iFrames. then you can add a nice sidescroll when changing images.