Forum Moderators: open

Message Too Old, No Replies

What does it want me to define..?

         

mylungsarempty

8:15 am on Sep 1, 2003 (gmt 0)

10+ Year Member



<SCRIPT type="text/javascript">

function anything()
{
document.write('anymessage')
}

document.write(anything())

</SCRIPT>

please to explain why the output in my browser from the above script is: anymessageundefined. What does it want me to define? i tried this:

<SCRIPT type="text/javascript">

function anyword()
{
var a = document.write('anymessage')
}

document.write(a)

</SCRIPT>

and got no output whatsoever. what does me do wrong here?

mylungsarempty

8:17 am on Sep 1, 2003 (gmt 0)

10+ Year Member



heh, i just realized why that 2nd one doesn't work... so don't bother telling me about how dumb i am for that one. i already know.

crxchaos

8:53 am on Sep 1, 2003 (gmt 0)

10+ Year Member



I'm not quite sure how you want to implement the script but here are two working versions with slightly different usage depending on what you are after:

<script type="text/javascript">
function anything ()
{
return 'anymessage';
}

document.write (anything ());
</script>
-------------------------------------
<script type="text/javascript">
function anything ()
{
document.write ('anymessage');
}

anything ();
</script>

It seems the problem was down to the fact that you were calling a document.write from within a document.write!

mylungsarempty

9:03 am on Sep 1, 2003 (gmt 0)

10+ Year Member



Thanks so much, crxchaos! I got this great idea for a site a while back, and i'm learning all the programming as i go along, kind of on a need-to-know basis. I mastered HTML when i was in jr. high, but it's been a while. I'm so grateful for this site. If my site makes me any money i'm definitely contributing financially.

mylungsarempty

11:46 am on Sep 1, 2003 (gmt 0)

10+ Year Member



<script type="text/javascript">
function anything ()
{
return 'anymessage';
return 'anyothermessage';
return 'monkeymonkeymonkey';
}
</script>

Now, apparently i can only use one return per function... is there a way around this? Some way do what i'm obviously trying to do above? I've been trying so many ways to use DIVs instead of frames, but i keep running into these silly errors that don't make sense to me...things that logically, should just WORK. using the 'visible' and 'hidden' attributes makes it such a pain to add a new page, as i need to go back then and edit every single link in the site... can anybody help me possibly write a javascript with, maybe some kind of array in which i can store all the DIVs and which basically says "if any ONE of these divs is selected, hide ALL the rest". I know this site isn't exactly to get others to do your homework for you, but... maybe a few hints? a push in the right direction? Thanks.