Forum Moderators: open

Message Too Old, No Replies

if I document.write my flash embeds...

what about people who don't have flash installed

         

HelenDev

2:44 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Will they get the usual alert to go get the plug in or do I need to do something else?

I think I originally asked this question in a thread about validating pages containing flash, but I think it got overlook in a much-argued subject!

Cheers,
H.

brucec

2:52 pm on May 21, 2004 (gmt 0)

10+ Year Member



yes, the web page visitor will get the prompt to download Flash plug in since your document.write method gets interpreted as HTML. The browser still displays the flash from your javascript and to the flash, whether indicated in HTML or a Javascript document.write object, the browser still needs the plug in.

HelenDev

2:58 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Marvellous! That reassures any doubts I was having about doing it.

I know I'm asking for trouble saying things like that ;)

HelenDev

3:14 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry I am a bit of a dumbo when it comes to js, but can anyone tell me why this would cause an error...

<script language="JavaScript">
document.write('
<object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=6,0,29,0" width="142" height="85">
<param name="movie" value="/adverts/movie1.swf">
<param name="quality" value="high">
<embed src="/adverts/movie1.swf" quality="high" pluginspage="http://www.macromedia.com/go/getflashplayer" type="application/x-shockwave-flash" width="142" height="85"></embed>
</object>
');
</script>

Bernard Marx

3:21 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of error do you have - "unterminated string"?

HelenDev

3:24 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



What kind of error do you have - "unterminated string"?

That's the one - 'Unterminated String Constant'

...at a line sometime after the bit of js ended

Bernard Marx

9:59 pm on May 21, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Sorry, only just saw your reply.

The safest thing to do is to write the whole thing,
from

[blue]document.write('[/blue]
to
[blue]');[/blue]

all on a single line.

Rambo Tribble

2:04 am on May 22, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Actually, you can do multiple lines something like this:

document.write('stuff to write'+
'another line of stuff'+
'still more stuff'+
'etc.');

What is screwing things up without the concatenation operator (the +) is JavaScript's automatic insertion of statement terminators (the semicolon, ;) at line endings. It's a case of the interpreter being too clever for its own good. Java, it should be stated, doesn't do this.

HelenDev

8:10 am on May 24, 2004 (gmt 0)

WebmasterWorld Senior Member 10+ Year Member



Cheers for the replies guys. Putting the + after each line or putting it all on one line works :).

However it does not validate for some reason :(
I am getting...

end tag for element "EMBED" which is not open
end tag for element "OBJECT" which is not open

...both way after the js has ended.

Anyone have any idea why?