Cable Forum

Cable Forum (https://www.cableforum.uk/board/index.php)
-   General IT Discussion (https://www.cableforum.uk/board/forumdisplay.php?f=19)
-   -   ANOTHER question about JavaScript!! (https://www.cableforum.uk/board/showthread.php?t=12567)

Womble 19-05-2004 23:26

ANOTHER question about JavaScript!!
 
Can anyone help? Below is my little JavaScript, my problem is I want the output to have astrix around it like so but cant remember how to do it..doh!
***********************************
The price of your ticket is
***********************************

This is my script............................................ .....................................
// to check the status of a prospective ticket purchaser
var age;
age = window.prompt('Please enter your age', '');
age = parseFloat(age);
while (age<5)
{
document.write ('You have made a mistake, please re-enter your age'+ '<BR>')
age = window.prompt('Please re-enter your age', '');
age = parseFloat(age);
}
if (age >59)
{
document.write
('The price of your ticket is a concessionary £8')
}
if (age <17)
{
document.write
('The price of your ticket is a concessionary £8')
}

else
{
document.write('The price of your ticket is £10')
}


Thanks for any input

Richard M 19-05-2004 23:38

Re: ANOTHER question about JavaScript!!
 
What's wrong with doing:

document.write('********************************** *<br />The price of your ticket is £10<br />***********************************')

?

Womble 20-05-2004 00:22

Re: ANOTHER question about JavaScript!!
 
Quote:

Originally Posted by Richard M
What's wrong with doing:

document.write('********************************** *<br />The price of your ticket is £10<br />***********************************')

?

I never thought of that!!
Blinding idea
Thank you

Womble 20-05-2004 00:32

Re: ANOTHER question about JavaScript!!
 
Ahh, it doesn't work!! I hate coding!!!!!!!!!!!

punky 20-05-2004 00:36

Re: ANOTHER question about JavaScript!!
 
Try using the HTML Entity value. For a * it is:

*

Put that anywhere in your HTML, and it would produce an asterix. Should work inside your document.write.

HTH

Edit: I forgot the entity automatically gets parsed into an astrisk :), sorry it is:

[&][#][4][2][;]

but without the [ and ]. All as one word.

punky 20-05-2004 02:40

Re: ANOTHER question about JavaScript!!
 
I thought your question was a bit weird Womble, so I decided to test it, and:

document.write('*****************<br>');

works fine for me. You must have a problem elsewhere. Can you post the whole file for us?


All times are GMT. The time now is 18:48.

Powered by vBulletin® Version 3.8.11
Copyright ©2000 - 2026, vBulletin Solutions Inc.
All Posts and Content are © Cable Forum