PDA

View Full Version : Hperlink within a JavaScript code


sandie
10-11-2002, 01:12 PM
Hi
I have this code:-


<Script Language="Javascript">
<!--
if( paslen == 0){
document.writeln('You did not select any messages.');
}else{
document.writeln("The messages with the following MessageID's were selected by you.");
document.writeln(passed);
document.write("\nYou selected " +paslen+ " message(s), with the following MessageID(s):- \n");
for(i = 0; i < paslen; i++){
document.writeln("\n" +messageids[i] );
}
}
//-->
</script>


I would like the colored portion to be a hyperlink or if possible a button!

Any help will be very much appreciated(as always, by me)

Thank you!

mpjbrennan
10-11-2002, 03:37 PM
Try:

document.writeln("\n <a href='" + messageids[i] + "'>hyperlink text here</a>")

note: after the = sign there is a single quote ' followed by a double quote "; after the second + sign there is a double quote followed by a single quote.

patrick

beetle
10-11-2002, 03:38 PM
What is stored in the messageids array? URLs? If so, this will do ya...

document.writeln('<br><input type="button" onClick="top.location.href=\''+messageids[i]+'\';">');

If not...then I need to know what messageids is storing....