I'm am totally crap at Javascript. Basically, I have grabbed bits of code from the Internet to put something together that will do the following.;
I need something that will give me a re-usable bit of code, so I can get a confirmation message appear before they are taken to a link. I tried it simply in a href, like;
That brought up the confirmation message, but whether you clicked on the 'ok' or 'cancel' button, it still took you to that URL.
I then tried the following code that I put otgether (remember, I'm crap at Javascript).... It doesn't work at all, but I'm hoping to give you an idea of what I am trying to do.
<!--
function genericConfirmAlert()
var URL;
{if (confirm("message-text"))
{location.href = URL;}}
// -->
</script>
<a href="JavaScript:genericConfirmAlert('http://www.google.com')">link-text</a>
Anyone got any suggestions? (I have searched the Net, but as you can see, nothing of working relevance turned up).
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates
I need something that will give me a re-usable bit of code, so I can get a confirmation message appear before they are taken to a link. I tried it simply in a href, like;
Code:
<a href="http://www.google.com" onMouseOver="confirm('What do you think?')">test link to google</a>That brought up the confirmation message, but whether you clicked on the 'ok' or 'cancel' button, it still took you to that URL.
I then tried the following code that I put otgether (remember, I'm crap at Javascript).... It doesn't work at all, but I'm hoping to give you an idea of what I am trying to do.
Code:
<script language="JavaScript"> <!--
function genericConfirmAlert()
var URL;
{if (confirm("message-text"))
{location.href = URL;}}
// -->
</script>
<a href="JavaScript:genericConfirmAlert('http://www.google.com')">link-text</a>
Anyone got any suggestions? (I have searched the Net, but as you can see, nothing of working relevance turned up).
Cheers
Andy (mod)
andy@ultranerds.co.uk
IMPORTANT: I've now moved to ultranerds.co.uk, and the .com will no longer work!
Want to give me something back for my help? Please see my Amazon Wish List
GLinks ULTRA Package (plugins total "value" $3,325 & rising, for just $350)| GLinks ULTRA Package PRO (plugins total "value" $5,625 & rising, for just $500)
Support Forum | Links SQL Plugins | DMOZ Dumps | UltraNerds | ULTRAGLobals Plugin | Pre-Made Template Sets | FREE GLinks Plugins!
Compare our different Plugin packages *new* Free CSS Templates

