Is it possible to display an alert message with a link to somewhere inside it?
The only other way I can think of is to create a pop-up window with a link to where I want to go, but I won’t know if it has been blocked or if javascript is disabled.
@ZeroKilledOct 19.2007 — #alert message doesn't display other content than plain text, no image, no link, no html redering, just text. that is how the alert work. if user had disabled javascript you can neighter display an alert message.
@JMRKERauthorOct 19.2007 — #Thanks 'ZeroKilled'. Saves a lot of effort.
I'll try a dynamic pop-up with link.
Purpose: I want to tell the user there is a link they can go to and allow that to happen or just cancel the pop-up window if they choose not to go to the link.
function SetJumpToMenu() { var str = ''; str += '<select id="JumpToSites"'; str += ' onChange="JumpTo(this.value);document.getElementById('AddLinks').style.display='none'">'; str += '<option value="">Useful Sites</option>'; for (var i=0; i<SiteList.length-1; i++) { site = SiteList[i].split('|'); str += '<option value="'+site[0]+'">'+site[1]+'</option>'; } str += '</select>'; return str; }
var User = 'username'; var Site = 'domain.edu'; function EmailUser() { var str = '<a href="mailto:' + User+'@'+Site; str += '?Subject=Useful links&Body=Send the site URL'; str += ' and Description" />?</a>'; return str; } function ToggleInfo(IDinfo) { var obj = document.getElementById(IDinfo); if (obj.style.display == 'none') { obj.style.display = ''; } else { obj.style.display = 'none'; } } </script>
</head> <body>
<script type="text/javascript"> document.write(SetJumpToMenu()); document.write('<a href="#" onClick="ToggleInfo('AddLinks')">Add?</a>'); document.write('<div id="AddLinks"'); document.write(' style="display:none;background-color:yellow;width:200">'); var str='Want to add more links here?<p />'; str += 'Send an email with site URL<br /> and a description to:<br />'; str += '<a href="mailto:' + User+'@'+Site; str += '?Subject=Useful links&Body=Send the site URL'; str += ' and Description" />'+User+'@'+Site+'</a>'; document.write(str); document.write(EmailUser()); document.write('</div>'); </script> <p />Additional page information continues:<br /><hr /> </body> </html> [/code]
Would welcome any thoughts on script improvements.
Next feature I would like to add would be to pass a parameter
in the function SetJumpToMenu('SiteList') to allow different 'SiteList' array names
to be passed for multiple select box displays on the page.