Html tags in alert box?

Hi all,

I am running into problems with JS again :sick:

The situation now is that I have a set of assesment quiz questions for my users and once they click ‘submit’, there will be a message box showing the results. Among wrong answers, I will want to include a link back to the relevant sections so they can just click to load a new window showing the relevant section.

However, the <a herf=…>See the reference</a> tags also show up in the message box…Is there a way to code a link in a message box?

Any help / comment will be appreciated.
Thank you.

No, you can’t do that. If you want to display a link, you’ll have to use something other than the standard Javascript alert() box.

make your own “laert box” with a div or a span you will toggle from display none to diplay block …
You will then be able to put what ever you want in your alert box

I’d use javascript to open a new window that holds the results and links back to the relevant pages.

I would not use new window for popup blocker reasons …

Thanks for the replies :rolleyes:

Seems like I can’t do it with the alert(). I am thinking to open a new window like some of you have mentioned above to display the links and answers.

I have all the text stored in the variable, answerText.
May I know how to pass this variable to a new window for display?
Assuming I have the following submit button and Score() is the function that process the answers:


<input name="submit" type="submit" onClick="Score()" value="Submit">

Any help / advise will be further appreciated.
Thank you.

My advice : Avoid opening windows for popups …

<html>

<head>
<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
<title>Nouvelle page 1</title>
<style type="text/css">
.titlebar{font-size:11px;
		  font-family:verdana;
		  color:white;
		  font-weight:bold;
		  width:100%;
		  background-color:Darkslateblue;
		  padding:2px;
		  text-align:left;
		  }
		
.msgbox{border:outset 2px white;
		 background-color:gainsboro;
		 width:300px;
		 height:180px;
		 color:black;
		 padding-left:1px;
		 padding-right:2px;
		 padding-top:1px;
		 font-family: verdana;
		 font-size:11px;
		 text-align:center
			 }
.cross{border:outset 2px white;
		 background-color:gainsboro;
		 left:2px;
		 width:18px;
		 color:black;
 	     font-family:tahoma;
 	     float:right;
 	     margin-top:0px;
 	     padding-left:4px;
 	     padding-bottom:2px;
 	     padding-top:1px;
 	     top:0px;
 	     line-height:10px;
 	     cursor:default;
 	     }
.bouton{width:80px;
		 height:25px;
		 border:oustet 2px silver;
		 position:relative;
		 font-size:11px;
		 font-family: tahoma;
		 }

.innerText{width:100%;
			padding-left:30px;
			text-align:left;
			}		

#testzone {position:absolute;
           top:100px;
           left:200px;
           }
</style>


</head>

<body onload="document.getElementById('Box').innerHTML=answerText">
<input type="button" onclick="document.getElementById('testzone').style.display='block';" value="alert"/>
<div id='testzone' class="msgbox" style="display:none;" >
 <div class="titlebar">
  <div class="cross">X</div> Title
 </div>

<br/>
<br/>
<br/>
<div class='innerText' id="box">
</div>
<br/>
<br/>
<br/>
<div>
<input type="button" id="trap" value="YES" class="bouton" onclick="document.getElementById('testzone').style.display='none';" style="left:0px;"/>

<input type="button" id="trap" value="NO" class="bouton" style="left:5px;"/>
</div>

</div>

</body>

</html>

Thanks for your codes, SpaceFrog. :rolleyes:
However, I think i would like to open a new window for this task. I would really appreciate if you can go to the following thread and give me some advise:

Thank you.