...

View Full Version : Javascript Popup Alert Question



Spency
11-26-2012, 12:21 PM
Good day!

A kind member helped me out with a popup I was trying to create for a test taking suite.


<script language="JavaScript" type="text/javascript">
/*<![CDATA[*/
var twoletters = "First Take Z Quiz, Then Take Y Quiz"
var now = new Date().getSeconds(); // returns 0-59
if (now%2 == 0) { // even number
var twoletters = "First Take Y Quiz, Then Take Z Quiz";
}
alert (twoletters);
/*]]>*/
</script>

Now I understand that as an Alert, I can't change the title of the popup nor can I change the font size of the alert. Is this true? Is there any way I can alter at least the body text of the popup?

Thank you very much.

Philip M
11-26-2012, 02:36 PM
Now I understand that as an Alert, I can't change the title of the popup nor can I change the font size of the alert. Is this true? Is there any way I can alter at least the body text of the popup?




That is correct. You cannot alter the title or font sizes in an alert box. Alerts are really only for debugging purposes nowadays. Obviously the message in the alert is what you specify.

Remember that modern browsers block unrequested popups, and alert boxes may contain a dialog inviting the user to suppress further instances.

You would do best to display your message in a <span> for a few seconds.

felgall
11-26-2012, 07:40 PM
alert boxes may contain a dialog inviting the user to suppress further instances.

Some offer an option to turn off JavaScript for that web page instead.



EZ Archive Ads Plugin for vBulletin Copyright 2006 Computer Help Forum