Jump to content

JS


TheFiresInTheSky

Recommended Posts

i made a generator type thing which picks a random number. all you do is refresh the page. see here.the problem is, i would like to make that the background. i want to put a video of random numbers spinning through which i already have and when they click on the screen, it closes that video and goes back to the background showing the random number that way it looks better. heres the code,

 

<HTML><HEAD><TITLE>1-30</TITLE><script  LANGUAGE = "JavaScript">function picklink() { var linknumber = 30; var linktext = "white.jpg"; var randomnumber = Math.random(); var linkselect = Math.round( (linknumber-1) * randomnumber) + 1; if ( linkselect == 1 )	{ linktext = "1.bmp" } if ( linkselect == 2 )	{ linktext = "2.bmp" } if ( linkselect == 3 )	{ linktext = "3.bmp" } if ( linkselect == 4 )	{ linktext = "4.bmp" } if ( linkselect == 5 )	{ linktext = "5.bmp" } if ( linkselect == 6 )	{ linktext = "6.bmp" } if ( linkselect == 7 )	{ linktext = "7.bmp" } if ( linkselect == 8 )	{ linktext = "8.bmp" } if ( linkselect == 9 )	{ linktext = "9.bmp" } if ( linkselect == 10 )	{ linktext = "10.bmp" } if ( linkselect == 11 )	{ linktext = "11.bmp" } if ( linkselect == 12 )	{ linktext = "12.bmp" } if ( linkselect == 13 )	{ linktext = "13.bmp" } if ( linkselect == 14 )	{ linktext = "14.bmp" } if ( linkselect == 15 )	{ linktext = "15.bmp" } if ( linkselect == 16 )	{ linktext = "16.bmp" } if ( linkselect == 17 )	{ linktext = "17.bmp" } if ( linkselect == 18 )	{ linktext = "18.bmp" } if ( linkselect == 19 )	{ linktext = "19.bmp" }  if ( linkselect == 20 )	{ linktext = "20.bmp" } if ( linkselect == 21 )	{ linktext = "21.bmp" } if ( linkselect == 22 )	{ linktext = "22.bmp" } if ( linkselect == 23 )	{ linktext = "23.bmp" } if ( linkselect == 24 )	{ linktext = "24.bmp" } if ( linkselect == 25 )	{ linktext = "25.bmp" } if ( linkselect == 26 )	{ linktext = "26.bmp" } if ( linkselect == 27 )	{ linktext = "27.bmp" } if ( linkselect == 28 )	{ linktext = "28.bmp" } if ( linkselect == 29 )	{ linktext = "29.bmp" } if ( linkselect == 30 )	{ linktext = "30.bmp" } document.write('<IMG  SRC = "images/' + linktext + '">');}</SCRIPT></HEAD><TABLE  BORDER = 0  WIDTH = 100%><TR><TD  ALIGN = CENTER><script  LANGUAGE = "JavaScript">picklink()</SCRIPT></TD></TR><BODY background="" BGCOLOR="#000000">[color=#FF0000]<embed src="C:\other stuff\Aaron\AARONS FINISHED VIDEOS\lucky numbers\z1-30 nd.mpg" type="application/x-shockwave-flash" width="430" height="346"></embed>[/color]</BODY></HTML>

 

the red is the part that ive been working on and is not on the website. im having a problem putting that over the random number and making the random number bigger. then when you click on the video, it closes it.

please hurry on this because i cant be on during the week except this monday.

Link to comment
Share on other sites

damn dude. well, uh, you've tried to embed a local document (not going to fly) which is an mpeg, as a shockwave flash object (not going to fly).

 

also, if ( linkselect == 1 ) all the way to 30 is pretty atrocious.

Why wouldn't you just do something like:

linktext = linkselect + ".bmp"

 

(I don't do JS, but there is no reason for you to have to type out all of those IFs, in any language)

Click here if CCleaner Issues are re-appearing

 

DjLizard.net

DjLizard.net wiki

Dial-a-fix

Dial-a-fix tips

DjLizard.net software support forum

 

Do you live in Bradenton, Sarasota, Tampa, or St. Petersburg, Florida? Visit Digital Doctors where I work :)

Link to comment
Share on other sites

i dont know JS but i found that code and decided to try it and it worked. so how do i put a video on there? the video itself worked by the way.

Link to comment
Share on other sites

you'll have to upload it, because you can't have the JS access your local system. It's against most browser's security policies.

Click here if CCleaner Issues are re-appearing

 

DjLizard.net

DjLizard.net wiki

Dial-a-fix

Dial-a-fix tips

DjLizard.net software support forum

 

Do you live in Bradenton, Sarasota, Tampa, or St. Petersburg, Florida? Visit Digital Doctors where I work :)

Link to comment
Share on other sites

i cant upload it cuz the computer im gonna be putting this on doesnt have internet connection. it will allow it tho with the browser that im using. (IE) since it doesnt have internet, thers no threat of viruses so i just changed the browsers settings and it works. no how would i set up the other part?

Link to comment
Share on other sites

Hi Aaron

 

For other people to be able to view the video you will have to upload it to your site then add the link to the video in the code, If you cannot host the video there is probably some free hosting sites about where you might be able to store the file but it should be fine using your video link if its just to display on your machine, For the video code you can use something like this to play the file:

 

 

<object id="WMPlay" width="500" height="400" class="im" classid="CLSID:6BF52A52-394A-11d3-B153-00C04F79FAA6" codebase="http://activex.microsoft.com/activex/controls/mplayer/en/nsmp2inf.cab#Version=5,1,52,701" standby="Loading Microsoft Windows Media Player components..." type="application/x-oleobject">			  <param name="URL" value="http://ENTERVIDEOLINK.wmv">			  <param name="AllowChangeDisplaySize" value="True">			  <param name=ShowControls value=1>			  <param name=ShowDisplay value=1>			  <param name=ShowStatusBar value=1>			  <param name=AutoStart value="TRUE">			  <embed name="WMplay" width="500" height="400" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/Downloads/Contents/Products/MediaPlayer/" src="http://ENTERVIDEOLINK.wmv" autostart="True"></embed>   </object>

 

 

For the random number there might be an easier way to display the numbers using code rather than the image having to load when the page is refreshed,

 

 

<form><input type="button" value="Create Number" onMouseOver="alert(Math.round(Math.random()*20))"></form> 

 

 

or

 

 

 <font size="+6" color="#FFFF00"><script LANGUAGE="JavaScript">quotes = new Array(21);quotes[0] = "0";quotes[1] = "1";quotes[2] = "2";quotes[3] = "3";quotes[4] = "4";quotes[5] = "5";quotes[6] = "6";quotes[7] = "7";quotes[8] = "8";quotes[9] = "9";quotes[10] = "10";quotes[11] = "11";quotes[12] = "12";quotes[13] = "13";quotes[14] = "14";quotes[15] = "15";quotes[16] = "16";quotes[17] = "17";quotes[18] = "18";quotes[19] = "19";quotes[20] = "20";index = Math.floor(Math.random() * quotes.length);document.write("<DL>\n");document.write("<DD>" + " " + quotes[index] + "\n");document.write("</DL>\n");</SCRIPT> </font> 

 

Link to comment
Share on other sites

woah, confused. i like what i have already that ive made. first, i can use this code,

 

<embed src="C:\other stuff\Aaron\AARONS FINISHED VIDEOS\lucky numbers\z1-30 nd.mpg" type="application/x-shockwave-flash" width="430" height="346"></embed>

 

and the video will show up. how do i make it so when you click on the screen or press a key it closes? second, how do i get the number to show up right behind it afterwards? thanks for the help andy but i think its just a little too confusing for me, figuring out where to put it n all.

Link to comment
Share on other sites

Im not sure how you would do that Aaron , It sounds impossible to make a page that will generate a random number then embed a video that plays, closes and returns to the same random number :blink:

 

You probably would have to code pop up scripts that will open the media player in a new window then close it to return to the random number, If the video is on the same page then it will play when the page loads and then the media player will stay visible, if you refreshed the page after playing the video or used a second page to return to then it would be a different number that appears so I think the pop up window option would be easier.

 

Here is a test page using the Random number code and embedding the media player in a pop up window.

 

If you need it all to be on the same page then you might be best posting the question on a coding forum because I'm not sure of ways to achieve that.

 

Andy

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use.