PDA

View Full Version : Java descriptor problem



Nicholaswhite
April 21st, 2001, 16:46
Hi, I'm using the following Javascript as a way to get news articles done without fussing around with fancy fonts etc. However, it doesn't allow for the html command <P> so I can't space it out at all. Can anyone put me out of my misery or refer me to another Java thingy that could do the job?

Many thanks,
Nicholas White



<html>
<head>
<title>FAQ Maker Script</title>
<!-- START FAQ MAKER SCRIPT -->
<!-- This part of the script goes between your HEAD tags. -->

<script LANGUAGE="JavaScript">
<!-- This script is courtesy of Bravenet Web Services. http://www.bravenet.com -->
<!-- Bravenet.com is the webs top rated site for FREE Webmaster Tools! -->

<!-- Hide Script From Non-JavaScript Browsers
<!-- This is where you set your total number of descriptions -->
TotalOfDescriptions = 4;

function MakeArray(n) {
this.length = n;
for (var i = 1; i <= n; i++) {
this[i] = 0 }
return this
}

Descriptions = new MakeArray(TotalOfDescriptions);

<!-- This is where you add your FAQs and descriptions. Don't forget to add these in the BODY tag too. -->
Descriptions[1] = "Select a news story now!";
Descriptions[2] = "Minardi boss Paul Stoddart has ruled out Prost reject Mazzacane's return to his team.";
Descriptions[3] = "Dave: I'm the nice guy at Bravenet!";
Descriptions[4] = "Brad: I let Dave PRETEND to be the nice guy.";

function ShowDescription() {

for (i=0; i < document.DescriptionForm.Menu.options.length; i++) {
if (document.DescriptionForm.Menu.options[i].selected==true) {
document.DescriptionForm.DescriptionTextArea.value=Descripti ons[i+1];
}
}
}

// Stop Hiding -->
<!-- END HEAD TAG PART OF SCRIPT. -->
</script>
</head>

<body BGCOLOR="#ffffff" link="#CC0033" vlink="#333399" alink="#FF0000">

<!-- This part of the script goes between your BODY tags. -->

<form NAME="DescriptionForm">
<p><select NAME="Menu" OnChange="ShowDescription()" size="1">
<option>Please Select: </option>
<option>News item </option>
<option>Dave </option>
<option>Brad </option>
</select> <textarea NAME="DescriptionTextArea" COLS="50" ROWS="4">Select a story now!</textarea>
</p>
</form>
<!-- END BODY TAG PART OF SCRIPT. -->
<!-- END FAQ MAKER SCRIPT -->
</body>
</html>

[Edited by Nicholaswhite on 04-22-2001 at 02:34 AM]

bigperm
April 21st, 2001, 19:43
That looks like javascript to me, not exactly an applet, and I didn't know that <p> was a command, thought it was a html tag.

I don't know what you are talking about.

Nicholaswhite
April 22nd, 2001, 02:36
No, I don't know what I'm talking about! It is a Javascript thingy, but I suppose you can't use html stuff like <P> in it. I don't really have much of a clue...

LeX
April 22nd, 2001, 05:03
Put the following code between your <HEAD></HEAD> tags:


<script LANGUAGE="JavaScript">
<!-- This script is courtesy of Bravenet Web Services. http://www.bravenet.com -->
<!-- Bravenet.com is the webs top rated site for FREE Webmaster Tools! -->

<!-- Hide Script From Non-JavaScript Browsers
<!-- This is where you set your total number of descriptions -->
TotalOfDescriptions = 4;

function MakeArray(n) {
this.length = n;
for (var i = 1; i <= n; i++) {
this = 0 }
return this
}

Descriptions = new MakeArray(TotalOfDescriptions);

<!-- This is where you add your FAQs and descriptions. Don't forget to add these in the BODY tag too. -->
Descriptions[1] = "Select a news story now!";
Descriptions[2] = "Minardi boss Paul Stoddart has ruled out Prost reject Mazzacane's return to his team.";
Descriptions[3] = "Dave: I'm the nice guy at Bravenet!";
Descriptions[4] = "Brad: I let Dave PRETEND to be the nice guy.";

function ShowDescription() {

for (i=0; i < document.DescriptionForm.Menu.options.length; i++) {
if (document.DescriptionForm.Menu.options.selected==true) {
document.DescriptionForm.DescriptionTextArea.value=Descripti ons[i+1];
}
}
}

// Stop Hiding -->
Put the following after your <BODY> tag:


<form NAME="DescriptionForm">
<p><select NAME="Menu" OnChange="ShowDescription()" size="1">
<option>Please Select: </option>
<option>News item </option>
<option>Dave </option>
<option>Brad </option>
</select> <textarea NAME="DescriptionTextArea" COLS="50" ROWS="4">Select a story now!</textarea>
</p>
</form>
That should do the trick.

[Edited by LeX on 04-22-2001 at 05:06 AM]