Javascript Initiate Sequence
I I have a Javascript code, that I want to initiate ONLY if a link is clicked.
I want to link to appear as a hyperlink, then when clicked, it will start the waiting code that will ask for the user's age, then it will cleanly redirect the parent page, without the need of popups or new windows.
If you can help, plz do so.
Thanks in advance.
All the best news here: https://newsbotnet.com
kazimmerman posted this at 01:53 — 11th December 2007.
He has: 698 posts
Joined: Jul 2005
It could go something like this:
<html>
...
<head>
<script language="javascript">
function makeUpACleverName() {
...code to ask for age...
window.location = "URL HERE";
}
</script>
</head>
...
<body>
<a href="#" onClick="makeUpACleverName()">Click here for the JavaScript thing</a>
</body>
</html>
You could also use CSS to disguise a regular tag as a link so you don't have to use a false target to have a link. Your CSS would look something like this:
.lookLikeALink {
text-decoration: underline;
cursor: pointer;
...
}
Kurtis
DarkLight posted this at 13:44 — 11th December 2007.
He has: 287 posts
Joined: Oct 2007
Ahh, this is similar to the script i made myself, i used this to verify mine, (which was wrong)
thanks for this, much appreciated.
webwiz posted this at 22:21 — 11th December 2007.
He has: 629 posts
Joined: May 2007
What's wrong with a regular link? (I see lots wrong with inline scripting, a link that goes nowhere, etc...)
I wonder what kind of answer you expect?
Cordially, David
--
delete from internet where user_agent="MSIE" and version < 8;
kazimmerman posted this at 00:06 — 12th December 2007.
He has: 698 posts
Joined: Jul 2005
I think using a regular link is just fine, but I don't see the need for one here, so that's why I offered a little styling help.
If it was redirecting to an actual new page, I would definitely suggest real links.
Kurtis
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.