JavaScript Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsWeb DesignJavaScript Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old August 23rd, 2001, 12:54 AM
Number Three's Avatar
Number Three Number Three is offline
Obsolete Vernacular
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: 76012
Posts: 278 Number Three User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 11 m 44 sec
Reputation Power: 13
Send a message via AIM to Number Three Send a message via MSN to Number Three Send a message via Yahoo to Number Three
Random Flash with JavaScript

I'm working on this code to generate a random Flash movie.


<SCRIPT LANGUAGE="JavaScript">
<!-- Begin
var howMany = 3
var movie = new Array(howMany+1)
movie[0]="http://www.flophouse.org/flashnav.swf"
movie[1]="http://www.flophouse.org/flashnav2.swf"
movie[2]="http://www.flophouse.org/flashnav3.swf"
movie[3]="http://www.flophouse.org/flashnav4.swf"
function rndnumber(){
var randscript = -1
while (randscript < 0 || randscript > howMany || isNaN(randscript)){
randscript = parseInt(Math.random()*(howMany+1))
}
return randscript
}
quo = rndnumber()
quox = movie[quo]
-->
</SCRIPT>

That works fine. If I write document.write(quox) it writes one of the URLs down. My problem is writing this into the actual HTML. I can't seem to get it right. Does anyone have any ideas? Should I be writing the entire Flash Object into a document.write script, or is there an easy way to call a JavaScript variable from a regular HTML page?

Reply With Quote
  #2  
Old August 30th, 2001, 12:04 AM
pieux pieux is offline
Seņor Member
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2000
Posts: 1,157 pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 h 23 m 35 sec
Reputation Power: 36
Since you can't insert <script> tags in the middle of another tag (which is what you would have to do to accomplish what you are asking in your last question), you will need to output the entire block of code (the <object> tag and also the <embed> tag, if you are using it, via document,write in the JavaScript. In the document.write, you can pass the variable. Basically, something like: document.write("blah blah" + variable + "blah blah").
__________________
Michael

Reply With Quote
  #3  
Old August 30th, 2001, 03:36 AM
Number Three's Avatar
Number Three Number Three is offline
Obsolete Vernacular
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2001
Location: 76012
Posts: 278 Number Three User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 h 11 m 44 sec
Reputation Power: 13
Send a message via AIM to Number Three Send a message via MSN to Number Three Send a message via Yahoo to Number Three
Talking

Thanks for your help! But only one problem: To define the quotes inside the HTML tags within the document.write("") function, what would I type? Like should it be

document.write("<object name=\"objectname\">")

?

Reply With Quote
  #4  
Old August 30th, 2001, 06:29 AM
pieux pieux is offline
Seņor Member
Dev Shed Beginner (1000 - 1499 posts)
 
Join Date: Aug 2000
Posts: 1,157 pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level)pieux User rank is Sergeant Major (2000 - 5000 Reputation Level) 
Time spent in forums: 1 h 23 m 35 sec
Reputation Power: 36
Yes, or you can use ' instead of ".

Reply With Quote
Reply

Viewing: Dev Shed ForumsWeb DesignJavaScript Development > Random Flash with JavaScript

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap