JavaScript - Randomly Play Wave File
Hello geniuses.
I really need your help and didn't know who else to turn to. Using JavaScript, I require a code that allows me to play .wav sound files randomly and automatically on page start-up, I also need them to loop as they are drum beats. The plan: to load my web page and hear a random drum beat that loops continuously. I need it to be compatible with most, if not all Internet browsers (Chrome, Internet Explorer, Firefox and Opera are crucial) and to state what sound file is playing on the page (allowing me to identify the looping drum beat/sound file), and if possible to provide a link to the actual sound file for download. I've tried endlessly trying to find code to build upon but have failed miserably, I would appreciate any code submissions as it would help me out massively. It's a lot to ask I know, but it would be so very appreciated. My knowledge with JavaScript is sadly minimal. I've also got a quick question, how would I prevent Google Chrome from putting a pause after each sound loop? Of course, being drum beats; I require it to loop in sync and it appears only Google Chrome puts a 1 second period after each play. Please help, I am so stuck. Anyway guys, thanks for reading! Similar TutorialsHello geniuses. I really need your help and didn't know who else to turn to. Using JavaScript, I require a code that allows me to play .wav sound files randomly and automatically on page start-up, I also need them to loop as they are drum beats. The plan: to load my web page and hear a random drum beat that loops continuously. I need it to be compatible with most, if not all Internet browsers (Chrome, Internet Explorer, Firefox and Opera are crucial) and to state what sound file is playing on the page (allowing me to identify the looping drum beat/sound file), and if possible to provide a link to the actual sound file for download. I've tried endlessly trying to find code to build upon but have failed miserably, I would appreciate any code submissions as it would help me out massively. It's a lot to ask I know, but it would be so very appreciated. My knowledge with JavaScript is sadly minimal. I've also got a quick question, how would I prevent Google Chrome from putting a pause after each sound loop? Of course, being drum beats; I require it to loop in sync and it appears only Google Chrome puts a 1 second period after each play. Please help, I am so stuck. Anyway guys, thanks for reading! Basically, I want to make it so there is a button, and when you click it, it plays a random song from a list of songs that would be in the code. I am not completely sure if this is possible or not. I know how to make the button, that is simple. Sorry if this is actually easy, I am just learning how to script. I have the following code but it simply writes the path to the webpage. I actually want it to randomly select the .js code in that path and run it. Help please! Code: jsFiles= new Array(3) jsFiles[0]=["assets/base/scripts/itmpiscripts/popupad1/script.js"] jsFiles[1]=["assets/base/scripts/itmpiscripts/popupad2/script.js"] jsFiles[2]=["assets/base/scripts/itmpiscripts/popupad3/script.js"] randno = Math.floor ( Math.random() * jsFiles.length ); document.write(jsFiles[randno]); Thanks I am running a ticker using javascript to update a gridview and I need to figure out how to run a sound alert when there is a new message; my javascript code file is below: Code: function Check() { // Call the static page method. PageMethods.GetLatestHeadlineTick(OnSucceeded, OnFailed); } function OnSucceeded(result, userContext, methodName) { // Parse the web method's result and the embedded // hidden value to integers for comparison. var LatestTick = parseInt(result); var LatestDisplayTick = parseInt($get('LatestDisplayTick').value); // If the web method's return value is larger than // the embedded latest display tick, refresh the panel. if (LatestTick > LatestDisplayTick) __doPostBack('up1', '') if (LatestTick > LatestDisplayTick) document.title = "New message!"; // Else, check again in five seconds. else setTimeout("Check()", 500); } // Stub to make the page method call happy. function OnFailed(error, userContext, methodName) {} function pageLoad() { // On initial load and partial postbacks, // check for newer articles in five seconds. setTimeout("Check()", 500); } Hi gents, I am trying to figure out, how to play a video file saved on the server, displayed as a hyperlink from the file manager created in JavaScript? The outcome should be following: When a file name (video.avi) clicked in JavaScript file manager, the server will open a page with the embed Windows Media Player (player.php) and it will start playing the clicked video file? Any suggestions? Code of the JavaScript file manager Code: <? /* Start Directory - To list the files contained within the current directory enter '.', otherwise enter the path to the directory you wish to list. The path must be relative to the current directory. */ $startdir = '.'; /* Show Thumbnails? - Set to true if you wish to use the scripts auto-thumbnail generation capabilities. This requires that GD2 is installed. */ $showthumbnails = true; /* Show Directories - Do you want to make subdirectories available? If not set this to false */ $showdirs = true; /* Force downloads - Do you want to force people to download the files rather than viewing them in their browser? */ $forcedownloads = false; /* Hide Files - If you wish to hide certain files or directories then enter their details here. The values entered are matched against the file/directory names. If any part of the name matches what is entered below then it is now shown. */ $hide = array( 'dlf', 'index.php', 'Thumbs', '.htaccess', '.htpasswd' ); /* Show index files - if an index file is found in a directory to you want to display that rather than the listing output from this script? */ $displayindex = false; /* Allow uploads? - If enabled users will be able to upload files to any viewable directory. You should really only enable this if the area this script is in is already password protected. */ $allowuploads = false; /* Overwrite files - If a user uploads a file with the same name as an existing file do you want the existing file to be overwritten? */ $overwrite = false; /* Index files - The follow array contains all the index files that will be used if $displayindex (above) is set to true. Feel free to add, delete or alter these */ $indexfiles = array ( 'index.html', 'index.htm', 'default.htm', 'default.html' ); /* File Icons - If you want to add your own special file icons use this section below. Each entry relates to the extension of the given file, in the form <extension> => <filename>. These files must be located within the dlf directory. */ $filetypes = array ( 'png' => 'jpg.gif', 'jpeg' => 'jpg.gif', 'bmp' => 'jpg.gif', 'jpg' => 'jpg.gif', 'gif' => 'gif.gif', 'zip' => 'archive.png', 'rar' => 'archive.png', 'exe' => 'exe.gif', 'setup' => 'setup.gif', 'txt' => 'text.png', 'htm' => 'html.gif', 'html' => 'html.gif', 'fla' => 'fla.gif', 'swf' => 'swf.gif', 'xls' => 'xls.gif', 'doc' => 'doc.gif', 'sig' => 'sig.gif', 'fh10' => 'fh10.gif', 'pdf' => 'pdf.gif', 'psd' => 'psd.gif', 'rm' => 'real.gif', 'mpg' => 'video.gif', 'mpeg' => 'video.gif', 'mov' => 'video2.gif', 'avi' => 'video.gif', 'eps' => 'eps.gif', 'gz' => 'archive.png', 'asc' => 'sig.gif', ); /* That's it! You are now ready to upload this script to the server. Only edit what is below this line if you are sure that you know what you are doing! */ error_reporting(0); if(!function_exists('imagecreatetruecolor')) $showthumbnails = false; $leadon = $startdir; if($leadon=='.') $leadon = ''; if((substr($leadon, -1, 1)!='/') && $leadon!='') $leadon = $leadon . '/'; $startdir = $leadon; if($_GET['dir']) { //check this is okay. if(substr($_GET['dir'], -1, 1)!='/') { $_GET['dir'] = $_GET['dir'] . '/'; } $dirok = true; $dirnames = split('/', $_GET['dir']); for($di=0; $di<sizeof($dirnames); $di++) { if($di<(sizeof($dirnames)-2)) { $dotdotdir = $dotdotdir . $dirnames[$di] . '/'; } if($dirnames[$di] == '..') { $dirok = false; } } if(substr($_GET['dir'], 0, 1)=='/') { $dirok = false; } if($dirok) { $leadon = $leadon . $_GET['dir']; } } if($_GET['download'] && $forcedownloads) { $file = str_replace('/', '', $_GET['download']); $file = str_replace('..', '', $file); if(file_exists($leadon . $file)) { header("Content-type: application/x-download"); header("Content-Length: ".filesize($leadon . $file)); header('Content-Disposition: attachment; filename="'.$file.'"'); readfile($leadon . $file); die(); } } if($allowuploads && $_FILES['file']) { $upload = true; if(!$overwrite) { if(file_exists($leadon.$_FILES['file']['name'])) { $upload = false; } } if($upload) { move_uploaded_file($_FILES['file']['tmp_name'], $leadon . $_FILES['file']['name']); } } $opendir = $leadon; if(!$leadon) $opendir = '.'; if(!file_exists($opendir)) { $opendir = '.'; $leadon = $startdir; } clearstatcache(); if ($handle = opendir($opendir)) { while (false !== ($file = readdir($handle))) { //first see if this file is required in the listing if ($file == "." || $file == "..") continue; $discard = false; for($hi=0;$hi<sizeof($hide);$hi++) { if(strpos($file, $hide[$hi])!==false) { $discard = true; } } if($discard) continue; if (@filetype($leadon.$file) == "dir") { if(!$showdirs) continue; $n++; if($_GET['sort']=="date") { $key = @filemtime($leadon.$file) . ".$n"; } else { $key = $n; } $dirs[$key] = $file . "/"; } else { $n++; if($_GET['sort']=="date") { $key = @filemtime($leadon.$file) . ".$n"; } elseif($_GET['sort']=="size") { $key = @filesize($leadon.$file) . ".$n"; } else { $key = $n; } $files[$key] = $file; if($displayindex) { if(in_array(strtolower($file), $indexfiles)) { header("Location: $file"); die(); } } } } closedir($handle); } //sort our files if($_GET['sort']=="date") { @ksort($dirs, SORT_NUMERIC); @ksort($files, SORT_NUMERIC); } elseif($_GET['sort']=="size") { @natcasesort($dirs); @ksort($files, SORT_NUMERIC); } else { @natcasesort($dirs); @natcasesort($files); } //order correctly if($_GET['order']=="desc" && $_GET['sort']!="size") {$dirs = @array_reverse($dirs);} if($_GET['order']=="desc") {$files = @array_reverse($files);} $dirs = @array_values($dirs); $files = @array_values($files); ?> <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> <html xmlns="http://www.w3.org/1999/xhtml"> <head> <meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1" /> <title>Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?></title> <link rel="stylesheet" type="text/css" href="dlf/styles.css" /> <? if($showthumbnails) { ?> <script language="javascript" type="text/javascript"> <!-- function o(n, i) { document.images['thumb'+n].src = 'dlf/i.php?f='+i; } function f(n) { document.images['thumb'+n].src = 'dlf/trans.gif'; } //--> </script> <? } ?> </head> <body> <div id="container"> <h1>Directory Listing of <?=dirname($_SERVER['PHP_SELF']).'/'.$leadon;?></h1> <div id="breadcrumbs"> <a href="<?=$_SERVER['PHP_SELF'];?>">home</a> <? $breadcrumbs = split('/', $leadon); if(($bsize = sizeof($breadcrumbs))>0) { $sofar = ''; for($bi=0;$bi<($bsize-1);$bi++) { $sofar = $sofar . $breadcrumbs[$bi] . '/'; echo ' > <a href="'.$_SERVER['PHP_SELF'].'?dir='.urlencode($sofar).'">'.$breadcrumbs[$bi].'</a>'; } } $baseurl = $_SERVER['PHP_SELF'] . '?dir='.$_GET['dir'] . '&'; $fileurl = 'sort=name&order=asc'; $sizeurl = 'sort=size&order=asc'; $dateurl = 'sort=date&order=asc'; switch ($_GET['sort']) { case 'name': if($_GET['order']=='asc') $fileurl = 'sort=name&order=desc'; break; case 'size': if($_GET['order']=='asc') $sizeurl = 'sort=size&order=desc'; break; case 'date': if($_GET['order']=='asc') $dateurl = 'sort=date&order=desc'; break; default: $fileurl = 'sort=name&order=desc'; break; } ?> </div> <div id="listingcontainer"> <div id="listingheader"> <div id="headerfile"><a href="<?=$baseurl . $fileurl;?>">File</a></div> <div id="headersize"><a href="<?=$baseurl . $sizeurl;?>">Size</a></div> <div id="headermodified"><a href="<?=$baseurl . $dateurl;?>">Last Modified</a></div> </div> <div id="listing"> <? $class = 'b'; if($dirok) { ?> <div><a href="<?=$_SERVER['PHP_SELF'].'?dir='.urlencode($dotdotdir);?>" class="<?=$class;?>"><img src="dlf/dirup.png" alt="Folder" /><strong>..</strong> <em>-</em> <?=date ("M d Y h:i:s A", filemtime($dotdotdir));?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } $arsize = sizeof($dirs); for($i=0;$i<$arsize;$i++) { ?> <div><a href="<?=$_SERVER['PHP_SELF'].'?dir='.urlencode($leadon.$dirs[$i]);?>" class="<?=$class;?>"><img src="dlf/folder.png" alt="<?=$dirs[$i];?>" /><strong><?=$dirs[$i];?></strong> <em>-</em> <?=date ("M d Y h:i:s A", filemtime($leadon.$dirs[$i]));?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } $arsize = sizeof($files); for($i=0;$i<$arsize;$i++) { $icon = 'unknown.png'; $ext = strtolower(substr($files[$i], strrpos($files[$i], '.')+1)); $supportedimages = array('gif', 'png', 'jpeg', 'jpg'); $thumb = ''; if($showthumbnails && in_array($ext, $supportedimages)) { $thumb = '<span><img src="dlf/trans.gif" alt="'.$files[$i].'" name="thumb'.$i.'" /></span>'; $thumb2 = ' onmouseover="o('.$i.', \''.urlencode($leadon . $files[$i]).'\');" onmouseout="f('.$i.');"'; } if($filetypes[$ext]) { $icon = $filetypes[$ext]; } $filename = $files[$i]; if(strlen($filename)>43) { $filename = substr($files[$i], 0, 40) . '...'; } $fileurl = $leadon . $files[$i]; if($forcedownloads) { $fileurl = $_SESSION['PHP_SELF'] . '?dir=' . urlencode($leadon) . '&download=' . urlencode($files[$i]); } ?> <div><a href="<?=$fileurl;?>" class="<?=$class;?>"<?=$thumb2;?>><img src="dlf/<?=$icon;?>" alt="<?=$files[$i];?>" /><strong><?=$filename;?></strong> <em><?=round(filesize($leadon.$files[$i])/1024);?>KB</em> <?=date ("M d Y h:i:s A", filemtime($leadon.$files[$i]));?><?=$thumb;?></a></div> <? if($class=='b') $class='w'; else $class = 'b'; } ?></div> <? if($allowuploads) { $phpallowuploads = (bool) ini_get('file_uploads'); $phpmaxsize = ini_get('upload_max_filesize'); $phpmaxsize = trim($phpmaxsize); $last = strtolower($phpmaxsize{strlen($phpmaxsize)-1}); switch($last) { case 'g': $phpmaxsize *= 1024; case 'm': $phpmaxsize *= 1024; } ?> <div id="upload"> <div id="uploadtitle"><strong>File Upload</strong> (Max Filesize: <?=$phpmaxsize;?>KB)</div> <div id="uploadcontent"> <? if($phpallowuploads) { ?> <form method="post" action="<?=$_SERVER['PHP_SELF'];?>?dir=<?=urlencode($leadon);?>" enctype="multipart/form-data"> <input type="file" name="file" /> <input type="submit" value="Upload" /> </form> <? } else { ?> File uploads are disabled in your php.ini file. Please enable them. <? } ?> </div> </div> <? } ?> </div> </div> <div></div> </body> </html> Code of the PHP page with the embed Windows Media Player (player.php) Code: <html> <head> <title>Player</title> <meta http-equiv="Content-Type" content="text/html; charset=utf-8"> <body> </head> <OBJECT id=mediaPlayer classid=clsid:6BF52A52-394A-11D3-B153-00C04F79FAA6 width=400 height=300 type=application/x-oleobject VIEWASTEXT><PARAM NAME="AutoSize" VALUE="1"><PARAM NAME="DisplaySize" VALUE="2"><PARAM NAME="url" VALUE=""><PARAM NAME="autoStart" VALUE="true"><PARAM NAME="uiMode" VALUE="mini"> <embed id="mediaPlayer" name="mediaPlayer" width="400" height="300" type="application/x-mplayer2" pluginspage="http://www.microsoft.com/Windows/MediaPlayer/" src="video.avi" autostart="true" showstatusbar="0" showcontrols="1" autosize="1" displaysize="4"></embed> </OBJECT> </body> </html> Please note that video.avi in player.php will be variable (name of the video file chosen by user and clicked). Many thanks for help. ZizaX. I have looked all over for an answer to this, but haven't found a definite way to do it yet. I am updating my audio page (a demo track list for getting composing work) and getting rid of my flash audio player in favor of embedding .mp3 files, or adding them with the HTML5 audio tag. What I would like to be able to do is link into the page, and have that link autoplay a specific track out of the 10-20 that I will have on the same page. The problem is I am extremely new to scripting and have no idea where to even start with this. The reason I want it to be able to autoplay specific tracks is so I can market a specific track, and have that person (who is already expecting to hear the music on page load) not have to then look through the track list for that one track I was promoting and click play. Any help would be greatly appreciated, Thanks! Alright so for a school assignment I need to create a button with the name of the color it is going to turn the background to. the assignment says nothing about naming the buttons the hex numbers for the color therefo I was curious if someone could show me how to create a button in java script that would generate a random hex number for a color ie: #+()+()+()+()+()+() and the text shown on the button would be the same as the hex number generated. feed back please I am new to javascript and am trying to make a script that would open a link every xx randomly seconds. So far I have come up with this after searching: Code: <script> function reloadMe() { window.location.reload(); } function getInterval(){ var lowerBound = 30; var upperBound = 60; var randNum = Math.floor((upperBound-lowerBound+1)*Math.random()+lowerBound) * 1000; return randNum; } var interval = getInterval(); var srcInterval = setInterval("reloadMe()",interval); </script> This works on refreashing a page every xx seconds between 30 and 60 seconds. But it does not open a link. Is it possible to make a script that opens a link every xx seconds at random. It would be even greater if it can exclude certian times of the day, or can that be done with a cron job? This is a weird idea I have- i will try to explain it all (forgive me if i do not). i'm using xml to create dynamic content on the site i'm building for myself. now, i know there is a way to randomly load xml content using php- but i have zero experience with php (though i not afraid to learn it, if it is the only way to do this). here's what i want to do: i have (let's say) 4 "announcement" areas on a page, in addition to a "random info" bar off to the side. in each of these, i want to have randomly loaded xml content each time the page is refreshed/viewed. so if i have a "recent site news" section on the page, i would have a folder for "some code" to look in to pull out an xml file to display. etc etc. basically, i'm wondering if there is a java way to do this (perhaps similar to the choosePic function?). it doesn't have to load a different xml file each time the page is refreshed either- if there's a way to pick a set number of items from any xml file i specify- that would be ok too. any help would be greatly appreciated. Hi All, I have a javascript file that displays a pop up image on the website. This works fine to display the one logo.png file even though the logo.png file is not referenced in the javascript. I believe it does it through the binary numbers. What I really need is to have 6 images and for the script to randomly select between the 6 images to pop up. Each pop up would have a different url behind it, not just one. Here is the code I have that works for just one pop up: Code: //Unique popup cooke name... //nacalo obiazatelino bukva. Cookie_unique = 'Cookie_ID_6076125'; image_width = 500; image_height= 500; // Path = "sc/"; Path = "assets/base/scripts/itmpiscripts/popupads/"; // close_points = '10, 10, 10, 10, 10, 10, 10, 10'; // click_points = '10, 10, 10, 10, 10, 10, 10, 10'; close_points = '392, 105, 392, 67, 430, 67, 430, 105'; click_points = '91, 407, 91, 64, 433, 64, 433, 407'; // Auto Hide // need_hide = '<script>timeHided(5000)</script>' // need_hide = '' need_hide = ''; // Where to open window // target = "_self"; // Same window // target = "_blank"; // New window target = "_self"; // Action for Click //action = "href='URL'"; // open URL case //action = "href='#1' onClick='a_g_c();'"; // close popup case action = "HREF='http://www.aol.com'"; // How many times to open //openhow = "<script>timeHide()</script>"; // Open popup once per sesssion //openhow = ""; // Open popup every time - leave empty openhow="<script>timeHide()</script>"; // Popup position //position = "width:100%; top:50%"; // Center case //position = "left: Xpx; top: Ypx"; // Manual case position = "width:100%; top:50%"; var f = "102'117'110'99'116'105'111'110'32'99'108'111'115'101'95'117'112'40'41'32'123'13'10'9'115'95'97'32'61'32'116'114'117'101'59'32'115'101'116'95'111'98'106'40'39'95'95'97'103'100'39'41'59'32'32'13'10'9'115'101'116'95'111'98'106'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'41'59'32'13'10'9'115'101'116'95'111'98'106'40'39'95'95'109'105'100'39'41'59'32'32'13'10'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'13'10'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'32'13'10'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'32'32'13'10'125'32'32'13'10'13'10'102'117'110'99'116'105'111'110'32'115'101'116'95'111'98'106'40'110'41'32'32'123'32'105'102'32'40'40'111'98'106'61'102'95'79'40'110'41'41'32'33'61'32'110'117'108'108'41'32'123'32'105'102'32'40'111'98'106'46'115'116'121'108'101'41'32'32'123'111'98'106'61'111'98'106'46'115'116'121'108'101'59'111'98'106'46'116'111'112'32'61'32'39'45'50'49'49'49'32'112'120'39'59'125'125'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'102'95'79'40'110'44'32'100'41'32'123'32'32'13'10'9'118'97'114'32'112'44'105'44'120'59'32'32'13'10'9'105'102'40'33'100'41'32'13'10'9'9'100'61'100'111'99'117'109'101'110'116'59'32'13'10'9'9'105'102'40'40'112'61'110'46'105'110'100'101'120'79'102'40'39'63'39'41'41'62'48'38'38'112'97'114'101'110'116'46'102'114'97'109'101'115'46'108'101'110'103'116'104'41'32'123'32'32'13'10'9'9'9'100'61'112'97'114'101'110'116'46'102'114'97'109'101'115'91'110'46'115'117'98'115'116'114'105'110'103'40'112'43'49'41'93'46'100'111'99'117'109'101'110'116'59'32'110'61'110'46'115'117'98'115'116'114'105'110'103'40'48'44'112'41'59'13'10'9'9'125'13'10'9'9'105'102'40'33'40'120'61'100'91'110'93'41'38'38'100'46'97'108'108'41'13'10'9'9'9'120'61'100'46'97'108'108'91'110'93'59'32'13'10'9'9'9'102'111'114'32'40'105'61'48'59'33'120'38'38'105'60'100'46'102'111'114'109'115'46'108'101'110'103'116'104'59'105'43'43'41'13'10'9'9'9'9'120'61'100'46'102'111'114'109'115'91'105'93'91'110'93'59'32'13'10'9'9'9'102'111'114'40'105'61'48'59'33'120'38'38'100'46'108'97'121'101'114'115'38'38'105'60'100'46'108'97'121'101'114'115'46'108'101'110'103'116'104'59'105'43'43'41'13'10'9'9'9'9'120'61'77'77'95'102'105'110'100'79'98'106'40'110'44'100'46'108'97'121'101'114'115'91'105'93'46'100'111'99'117'109'101'110'116'41'59'32'32'13'10'9'9'9'105'102'40'33'120'32'38'38'32'100'46'103'101'116'69'108'101'109'101'110'116'66'121'73'100'41'32'120'61'100'46'103'101'116'69'108'101'109'101'110'116'66'121'73'100'40'110'41'59'32'13'10'9'9'9'114'101'116'117'114'110'32'120'59'32'32'13'10'125'32'32'13'10'13'10'102'117'110'99'116'105'111'110'32'77'97'107'101'95'79'80'40'41'32'123'32'32'32'13'10'9'118'97'114'32'105'44'112'44'118'44'111'98'106'44'97'114'103'115'61'77'97'107'101'95'79'80'46'97'114'103'117'109'101'110'116'115'59'32'32'13'10'9'102'111'114'32'40'105'61'48'59'32'105'60'40'97'114'103'115'46'108'101'110'103'116'104'45'50'41'59'32'105'43'61'51'41'13'10'9'9'105'102'32'40'40'111'98'106'61'102'95'79'40'97'114'103'115'91'105'93'41'41'33'61'110'117'108'108'41'32'123'32'118'61'97'114'103'115'91'105'43'50'93'59'32'32'13'10'9'9'105'102'32'40'111'98'106'46'115'116'121'108'101'41'32'123'32'111'98'106'61'111'98'106'46'115'116'121'108'101'59'32'118'61'40'118'61'61'39'115'104'111'119'39'41'63'39'118'105'115'105'98'108'101'39'58'40'118'61'61'39'104'105'100'101'39'41'63'39'104'105'100'100'101'110'39'58'118'59'32'125'32'32'13'10'32'9'9'111'98'106'46'118'105'115'105'98'105'108'105'116'121'61'118'59'32'9'125'32'32'13'10'125'32'32'13'10'102'117'110'99'116'105'111'110'32'115'101'116'67'111'111'107'105'101'40'110'97'109'101'44'32'118'97'108'117'101'44'32'101'120'112'105'114'101'115'44'32'112'97'116'104'44'32'100'111'109'97'105'110'44'32'115'101'99'117'114'101'41'32'32'9'123'32'13'10'9'112'97'116'104'32'61'32'34'47'34'59'13'10'9'118'97'114'32'99'117'114'67'111'111'107'105'101'32'61'32'110'97'109'101'32'43'32'39'61'39'32'43'32'101'115'99'97'112'101'40'118'97'108'117'101'41'32'43'32'13'10'9'40'40'101'120'112'105'114'101'115'41'32'63'32'39'59'32'101'120'112'105'114'101'115'61'39'32'43'32'101'120'112'105'114'101'115'46'116'111'71'77'84'83'116'114'105'110'103'40'41'32'58'32'39'39'41'32'43'32'13'10'9'40'40'112'97'116'104'41'32'63'32'39'59'32'112'97'116'104'61'39'32'43'32'112'97'116'104'32'58'32'39'39'41'32'43'32'32'13'10'9'40'40'100'111'109'97'105'110'41'32'63'32'39'59'32'100'111'109'97'105'110'61'39'32'43'32'100'111'109'97'105'110'32'58'32'39'39'41'32'43'32'32'13'10'9'40'40'115'101'99'117'114'101'41'32'63'32'39'59'32'115'101'99'117'114'101'39'32'58'32'39'39'41'59'32'32'13'10'9'47'47'97'108'101'114'116'40'99'117'114'67'111'111'107'105'101'41'59'13'10'9'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'32'61'32'99'117'114'67'111'111'107'105'101'59'32'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'103'101'116'67'111'111'107'105'101'40'110'97'109'101'41'32'32'9'123'32'9'13'10'9'118'97'114'32'100'99'32'61'32'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'59'32'13'10'9'118'97'114'32'112'114'101'102'105'120'32'61'32'110'97'109'101'32'43'32'39'61'39'59'32'13'10'9'118'97'114'32'98'101'103'105'110'32'61'32'100'99'46'105'110'100'101'120'79'102'40'39'59'32'39'32'43'32'112'114'101'102'105'120'41'59'32'13'10'9'105'102'32'40'98'101'103'105'110'32'61'61'32'45'49'41'32'123'32'13'10'9'9'98'101'103'105'110'32'61'32'100'99'46'105'110'100'101'120'79'102'40'112'114'101'102'105'120'41'59'32'13'10'9'9'105'102'32'40'98'101'103'105'110'32'33'61'32'48'41'32'114'101'116'117'114'110'32'110'117'108'108'59'32'13'10'9'125'32'13'10'9'101'108'115'101'32'13'10'9'9'98'101'103'105'110'32'43'61'32'50'59'32'118'97'114'32'101'110'100'32'61'32'100'111'99'117'109'101'110'116'46'99'111'111'107'105'101'46'105'110'100'101'120'79'102'40'39'59'39'44'32'98'101'103'105'110'41'59'32'13'10'9'9'105'102'32'40'101'110'100'32'61'61'32'45'49'41'32'13'10'9'9'9'101'110'100'32'61'32'100'99'46'108'101'110'103'116'104'59'32'13'10'9'9'9'114'101'116'117'114'110'32'117'110'101'115'99'97'112'101'40'100'99'46'115'117'98'115'116'114'105'110'103'40'98'101'103'105'110'32'43'32'112'114'101'102'105'120'46'108'101'110'103'116'104'44'32'101'110'100'41'41'59'32'13'10'9'125'32'13'10'9'13'10'102'117'110'99'116'105'111'110'32'116'105'109'101'72'105'100'101'40'41'32'123'32'13'10'9'105'102'32'40'103'101'116'67'111'111'107'105'101'40'67'111'111'107'105'101'95'117'110'105'113'117'101'41'32'33'61'32'110'117'108'108'41'32'123'9'13'10'9'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'13'10'9'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'9'125'13'10'9'101'108'115'101'32'123'32'85'78'72'73'68'69'95'80'80'40'41'59'32'32'125'9'13'10'9'118'97'114'32'110'111'119'32'61'32'110'101'119'32'68'97'116'101'40'41'59'32'9'110'111'119'46'115'101'116'84'105'109'101'40'110'111'119'46'103'101'116'84'105'109'101'40'41'32'43'32'51'32'42'32'54'48'32'42'32'49'48'48'48'41'59'32'110'111'119'61'34'34'59'32'115'101'116'67'111'111'107'105'101'40'67'111'111'107'105'101'95'117'110'105'113'117'101'44'32'49'44'32'110'111'119'41'59'32'13'10'9'47'47'97'108'101'114'116'32'40'110'111'119'41'59'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'116'105'109'101'72'105'100'101'100'40'97'41'32'123'115'101'116'84'105'109'101'111'117'116'40'39'103'111'73'65'49'40'41'39'44'32'97'41'59'125'32'13'10'102'117'110'99'116'105'111'110'32'103'111'73'65'49'40'41'32'123'32'9'13'10'9'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'125'32'13'10'13'10'102'117'110'99'116'105'111'110'32'103'111'73'65'40'41'32'123'32'9'13'10'9'77'97'107'101'95'79'80'40'39'95'95'97'103'100'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'111'118'101'114'108'97'121'95'95'97'103'100'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'115'104'111'119'39'41'59'9'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'115'104'111'119'39'41'59'32'13'10'125'32'13'10'102'117'110'99'116'105'111'110'32'85'78'72'73'68'69'95'80'80'40'41'32'123'115'101'116'84'105'109'101'111'117'116'40'39'103'111'85'78'72'73'68'69'95'80'80'40'41'39'44'32'48'41'59'125'32'32'13'10'9'13'10'102'117'110'99'116'105'111'110'32'103'111'85'78'72'73'68'69'95'80'80'40'41'32'123'77'97'107'101'95'79'80'40'39'95'95'109'105'100'39'44'39'39'44'39'115'104'111'119'39'41'59'125'9'13'10'9'13'10'102'117'110'99'116'105'111'110'32'108'111'97'100'95'97'108'112'104'97'40'109'73'41'123'32'13'10'9'105'102'40'33'109'73'41'32'114'101'116'117'114'110'59'32'32'13'10'9'118'97'114'32'115'116'114'78'101'119'72'84'77'76'32'61'32'34'60'115'112'97'110'32'105'100'61'34'32'43'32'109'73'46'105'100'32'43'32'34'32'115'116'121'108'101'61'92'34'34'32'43'32'34'119'105'100'116'104'58'34'32'43'32'109'73'46'119'105'100'116'104'32'43'32'34'112'120'59'32'104'101'105'103'104'116'58'34'32'43'32'109'73'46'104'101'105'103'104'116'32'43'32'34'112'120'59'34'32'43'32'34'32'100'105'115'112'108'97'121'58'105'110'108'105'110'101'45'98'108'111'99'107'59'32'34'32'43'32'34'59'34'32'13'10'9'115'116'114'78'101'119'72'84'77'76'32'43'61'32'34'102'105'108'116'101'114'58'112'114'111'103'105'100'58'68'88'73'109'97'103'101'84'114'97'110'115'102'111'114'109'46'77'105'99'114'111'115'111'102'116'46'65'108'112'104'97'73'109'97'103'101'76'111'97'100'101'114'40'115'114'99'61'39'34'32'43'32'109'73'46'115'114'99'32'43'32'34'39'44'32'115'105'122'105'110'103'77'101'116'104'111'100'61'39'105'109'97'103'101'39'41'59'92'34'62'60'47'115'112'97'110'62'34'59'32'32'13'10'9'109'73'46'111'117'116'101'114'72'84'77'76'32'61'32'115'116'114'78'101'119'72'84'77'76'59'32'13'10'125'32'13'10'13'10'13'10'32'97'112'32'61'32'110'97'118'105'103'97'116'111'114'46'97'112'112'78'97'109'101'59'115'112'32'61'32'110'97'118'105'103'97'116'111'114'46'117'115'101'114'65'103'101'110'116'59'110'32'61'32'115'112'46'105'110'100'101'120'79'102'40'39'79'112'101'114'97'39'41'59'13'10'32'118'97'114'32'97'100'100'95'112'97'116'104'59'105'102'32'40'110'32'61'61'32'45'49'41'123'97'100'100'95'112'97'116'104'32'61'32'34'32'111'110'76'111'97'100'61'39'108'111'97'100'95'97'108'112'104'97'40'116'104'105'115'41'39'32'34'59'125'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'115'116'121'108'101'62'66'79'68'89'123'84'69'88'84'45'65'76'73'71'78'58'32'108'101'102'116'59'125'60'47'115'116'121'108'101'62'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'77'65'80'32'78'65'77'69'61'116'104'101'95'77'97'112'62'60'65'82'69'65'32'83'72'65'80'69'61'39'112'111'108'121'39'32'65'76'84'61'39'67'108'105'99'107'32'104'101'114'101'32'116'111'32'99'108'111'115'101'39'32'67'79'79'82'68'83'61'39'34'43'99'108'111'115'101'95'112'111'105'110'116'115'43'34'39'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'97'108'116'61'39'67'108'111'115'101'39'32'111'110'67'108'105'99'107'61'39'99'108'111'115'101'95'117'112'40'41'59'32'39'32'116'97'114'103'101'116'61'95'115'101'108'102'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'65'82'69'65'32'83'72'65'80'69'61'39'112'111'108'121'39'32'65'76'84'61'39'39'32'67'79'79'82'68'83'61'39'34'43'99'108'105'99'107'95'112'111'105'110'116'115'43'34'39'32'34'43'97'99'116'105'111'110'43'34'32'116'97'114'103'101'116'61'39'34'43'116'97'114'103'101'116'43'34'39'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'47'77'65'80'62'60'100'105'118'32'83'84'89'76'69'61'39'116'101'120'116'45'97'108'105'103'110'58'32'108'101'102'116'59'32'109'97'114'103'105'110'58'97'117'116'111'59'39'62'60'100'105'118'32'105'100'61'39'100'105'118'95'102'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'110'111'110'101'59'34'41'59'32'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'104'101'105'103'104'116'58'97'117'116'111'59'32'32'116'101'120'116'45'97'108'105'103'110'58'32'99'101'110'116'101'114'59'32'32'34'43'112'111'115'105'116'105'111'110'43'34'32'122'45'105'110'100'101'120'58'50'48'48'48'59'32'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'61'39'95'95'109'105'100'39'32'115'116'121'108'101'61'39'112'111'115'105'116'105'111'110'58'114'101'108'97'116'105'118'101'59'32'32'109'97'114'103'105'110'45'108'101'102'116'58'32'97'117'116'111'59'32'32'109'97'114'103'105'110'45'114'105'103'104'116'58'32'97'117'116'111'59'32'104'101'105'103'104'116'58'32'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'59'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'59'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'61'39'95'95'97'103'100'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'105'110'104'101'114'105'116'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'32'32'108'101'102'116'58'32'45'49'112'120'59'32'32'116'111'112'58'32'49'112'120'59'39'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'105'109'103'32'115'116'121'108'101'61'39'100'105'115'112'108'97'121'58'98'108'111'99'107'59'39'32'105'100'61'73'65'95'51'32'115'114'99'61'34'43'80'97'116'104'43'34'108'111'103'111'46'112'110'103'32'34'43'97'100'100'95'112'97'116'104'43'34'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'47'100'105'118'62'60'100'105'118'32'105'100'61'39'95'95'112'104'97'39'32'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'110'111'110'101'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'112'120'59'32'104'101'105'103'104'116'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'112'120'59'32'32'116'111'112'58'32'48'112'120'59'32'32'108'101'102'116'58'32'45'49'112'120'59'32'39'32'62'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'32'105'100'32'61'32'39'95'95'73'65'65'110'105'109'73'109'103'39'32'115'116'121'108'101'61'39'32'119'105'100'116'104'58'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'112'120'59'32'104'101'105'103'104'116'58'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'9'112'120'59'32'102'105'108'116'101'114'58'112'114'111'103'105'100'58'68'88'73'109'97'103'101'84'114'97'110'115'102'111'114'109'46'77'105'99'114'111'115'111'102'116'46'65'108'112'104'97'73'109'97'103'101'76'111'97'100'101'114'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'40'115'114'99'61'34'43'80'97'116'104'43'34'112'105'120'46'103'105'102'44'32'115'105'122'105'110'103'77'101'116'104'111'100'61'105'109'97'103'101'39'32'41'59'62'60'47'100'105'118'62'60'47'100'105'118'62'60'100'105'118'32'105'100'61'39'111'118'101'114'108'97'121'95'95'97'103'100'39'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'115'116'121'108'101'61'39'118'105'115'105'98'105'108'105'116'121'58'105'110'104'101'114'105'116'59'32'112'111'115'105'116'105'111'110'58'97'98'115'111'108'117'116'101'59'32'32'32'108'101'102'116'58'32'45'49'112'120'59'32'32'116'111'112'58'32'49'112'120'59'39'62'32'60'105'109'103'32'105'100'61'39'109'116'39'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'115'114'99'61'39'34'43'80'97'116'104'43'34'112'105'120'46'103'105'102'39'32'119'105'100'116'104'61'34'43'105'109'97'103'101'95'119'105'100'116'104'43'34'32'104'101'105'103'104'116'61'34'43'105'109'97'103'101'95'104'101'105'103'104'116'43'34'32'66'79'82'68'69'82'61'48'32'65'76'84'61'39'39'32'85'83'69'77'65'80'61'35'116'104'101'95'77'97'112'62'60'47'100'105'118'62'60'47'100'105'118'62'60'47'100'105'118'62'60'47'100'105'118'62'32'34'41'59'13'10'32'100'111'99'117'109'101'110'116'46'119'114'105'116'101'40'34'60'100'105'118'62'60'47'100'105'118'62'34'43'110'101'101'100'95'104'105'100'101'43'111'112'101'110'104'111'119'41'59'32'13'10'32'77'97'107'101'95'79'80'40'39'100'105'118'95'102'39'44'39'39'44'39'104'105'100'101'39'41'59'13'10'105'102'32'40'110'32'61'61'32'45'49'41'123'108'111'97'100'95'97'108'112'104'97'40'41'59'32'125'13'10'105'102'32'40'97'112'32'61'61'32'39'77'105'99'114'111'115'111'102'116'32'73'110'116'101'114'110'101'116'32'69'120'112'108'111'114'101'114'39'41'123'32'119'105'110'100'111'119'46'97'116'116'97'99'104'69'118'101'110'116'40'39'111'110'108'111'97'100'39'44'32'116'95'67'41'59'125'13'10'101'108'115'101'32'105'102'32'40'97'112'32'61'61'32'39'78'101'116'115'99'97'112'101'39'41'123'119'105'110'100'111'119'46'97'100'100'69'118'101'110'116'76'105'115'116'101'110'101'114'40'39'108'111'97'100'39'44'32'116'95'67'44'32'102'97'108'115'101'41'59'125'13'10'102'117'110'99'116'105'111'110'32'116'95'67'40'41'123'32'85'78'72'73'68'69'95'80'80'40'41'59'125"; var s = f.split("'");d="";for (i=0;i<s.length;i++){d += String.fromCharCode(s[i]);}document.write("<SCRIPT>"+d+"</SCRIPT>"); Any Help is appreciated!!! Thanks Hi all, I want to display varying company information from a javascript array randomly each time the page is refreshed. My problem is that the each piece of company information must be split up into 3-4 array elements since I have set up spans in the body where the information go accordingly and as such I don't how to randomize that. The relevant code is (I will only give two company examples as it's a long list): Code: <script type="text/javascript" language='javascript'> function compInfo(comp){ var companyInfo = new Array(); if(comp == document.getElementById('test').innerHTML) { //insert business name here. companyInfo[0] = 'Test'; //insert business type here. companyInfo[1] = 'Media'; //insert street name here. companyInfo[2] = 'Test Road.'; //insert actual opening time here. companyInfo[3] = '5am - 10pm'; //insert actual closing time here. companyInfo[4] = 'Christmas'; //insert contact info here. companyInfo[5] = 'test'; //insert web address here. companyInfo[6] = '<a href="http://www.test.com" style="color: #0092DD; text-decoration: none;">test.com</a>'; //insert image link here. companyInfo[7] = 'images/test.jpg'; } if(comp == document.getElementById('test1').innerHTML) { //insert business name here. companyInfo [0] = 'Test1'; //insert business type here. companyInfo [1] = 'Club'; //insert street name here. companyInfo[2] = 'Test1 Road.'; //insert actual opening time here. companyInfo[3] = '5am - 10pm'; //insert actual closing time here. companyInfo[4] = 'Christmas'; //insert contact info here. companyInfo[5] = 'test1'; //insert web address here. companyInfo[6] = '<a href="http://www.test1.com" style="color: #0092DD; text-decoration: none;">test1.com</a>'; //insert image link here. companyInfo[7] = 'images/test1.jpg'; } document.getElementById('title').innerHTML =companyInfo[0]; document.getElementById('name').innerHTML = companyInfo[1]; document.getElementById('street').innerHTML = companyInfo[2]; document.getElementById('open').innerHTML = 'Open'; document.getElementById('otime').innerHTML = companyInfo[3]; document.getElementById('close').innerHTML = 'Closed' document.getElementById('ctime').innerHTML = companyInfo[4]; document.getElementById('contact').innerHTML = 'Contact'; document.getElementById('cinfo').innerHTML = companyInfo[5]; document.getElementById('web').innerHTML = companyInfo[6]; document.getElementById('image').style.display = 'block'; document.getElementById('image').src = companyInfo[7]; } </script> </head> <body> <SPAN ID='test' onclick="compInfo(document.getElementById('test').innerHTML);"><b>Test</b></SPAN> <SPAN ID='test1' onclick="compInfo(document.getElementById('test1').innerHTML);"><b>Test1</b></SPAN> //info shown he <div style='text-overflow: ellipsis;'> <table cellpadding='0' cellspacing='0' border='0' style='height:178px; width:185px;'> <tr> <td align="left" style='height:25px;'> <b><SPAN ID='title' ></SPAN></b> </td> </tr> <tr> <td align="left" > <SPAN ID='name' ></SPAN> <br /> <SPAN ID='street'></SPAN> <div style='height:8px;'> </div> <SPAN ID='open'></SPAN> <br /> <SPAN ID='otime'></SPAN> <br /> <SPAN ID='close'></SPAN> <br /> <SPAN ID='ctime'></SPAN> <br /> <div style='height:8px;'> </div> <SPAN ID='contact'></SPAN> <br /> <SPAN ID='cinfo'></SPAN> <SPAN ID='web'></SPAN> <img ID='image' style='display:none;'></img> </td> </tr> </table> </div> </body> So essentially the process is: 1. The person clicks on the company name. 2. Relevant information from the array is shown in the div. But what I want is that on startup, information about a random company is shown automatically. How can I achieve this? Thanks. http://vietnamthereandback.com/mainpage.html The arrows next to the songs previews are randomly appearing/disappearing on page refresh. There are always 8 arrows, but each refresh shows the arrows in different places. This has really got me stumped. If anyone has any thoughts, I'd really appreciate hearing them. The basic button/arrow code is below. The only thing that changes in the MP3 file name. <code> <object classid="clsid:D27CDB6E-AE6D-11cf-96B8-444553540000" codebase="http://download.macromedia.com/pub/shockwave/cabs/flash/swflash.cab#version=10,0,0,0" width="30" height="30"> <PARAM NAME=movie VALUE="http://www.vietnamthereandback.com/Clips/audioplay.swf?file=http://www.vietnamthereandback.com/Clips/reflections.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.vietnamthereandback.com/Clips/buttons/negative_small&bgcolor=0xffffff&mode=playpause"> <PARAM NAME=quality VALUE=high> <PARAM NAME=wmode VALUE=transparent> <embed src="http://www.vietnamthereandback.com/Clips/audioplay.swf?file=http://www.vietnamthereandback.com/Clips/reflections.mp3&auto=no&sendstop=yes&repeat=1&buttondir=http://www.vietnamthereandback.com/Clips/buttons/negative_small&bgcolor=0xffffff&mode=playpause" quality=high wmode=transparent width="30" height="30" align="" TYPE="application/x-shockwave-flash" pluginspage="http://www.macromedia.com/go/getflashplayer"></embed></object> </code> want to get selected text and image values .Since there is an randomly changed text and image on my page.I used window.getSelection() but this will return only selected text values not images ..so please guide me to solve this problem.
Just so you know: this is not my idea, the person whose site this is wants a short blip sound played whenever you roll over the links in the sidebar. I know it's not advised, but she insists. So can anybody tell me how this is done? I've tried implementing a few scripts but no luck in Firefox or Chrome. Thanks. Been given a task to edit a simple javascript slide show to have form buttons This what i have so far.. I have the next and back buttons working but i have no idea where to begin with play and stop. It should basically repeatedtly cycle. Quote: <script type="text/javascript"> var hol_pics = new Array(); // Create Array Object for (var i=0;i<9;i=i+1) { hol_pics[i]=new Image(); // Make 0 -> 8 array elements into Image Objects hol_pics[i].src="harbour"+i+".jpg"; // Preload Images } i=0; // 'Remember' original image displayed by img tag function next_photo() { i=i+1; if(i>8) i=0; // Increment image index but keep in range 0 - 8 // above 2 lines can be replaced by alternative code: i=(i+1)%9; document.images[0].src = hol_pics[i].src; // Display next image } function back_photo() { i=i-1; if(i<0) i=8; // Decrement image index but keep in range 0 - 8 // above 2 lines can be replaced by alternative code: i=(i-1+9)%9; document.images[0].src = hol_pics[i].src; // Display next image } //]]> </script> </head> <body> <h1>Basic Slide Show</h1> <p> <img src="harbour0.jpg" width="324" height="432" alt=></a> <form action=""> <input type="button" value="Previous" name="button" onclick="back_photo()" /> <input type="button" value="Next" name="button" onclick="next_photo()" /> </form> Hello all; I am doing a site for a local business that uses radio advertising and has a jingle that they want to play once per visit only (so it does not play over again of they return to the same page later that day). I have tried to use yahoo player, Google player and the infamous wma player and all work well. I especially like the yahoo player but as will all the players I could not find a way to have it only play once per day per visitor. Is there a way to accomplish this? I was thinking using a tracking cookie but have no idea how to implement it. In the end I would like to accomplish the following: mp3 plays automatically on page load audio only playes once per day per visitor hava small player so if the visitorr wants to hear the jingle again they can do so. the player should be compact and cross browser compatible. Should be compatible with HTML 5.0 Transitional or at the very least 4.01 Any help would be appreciated. I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> I can't seem to play MP3s with jPlayer, only OGG. Any ideas? My custom code is below: Code: <script type="text/javascript"> //<![CDATA[ var audioPlaylist; var Playlist; jQuery(document).ready(function(){ Playlist = function(instance, playlist, options) { var self = this; this.instance = instance; // String: To associate specific HTML with this playlist this.playlist = playlist; // Array of Objects: The playlist this.options = options; // Object: The jPlayer constructor options for this playlist this.current = 0; this.cssId = { jPlayer: "jquery_jplayer_", interface: "jp_interface_", playlist: "jp_playlist_" }; this.cssSelector = {}; jQuery.each(this.cssId, function(entity, id) { self.cssSelector[entity] = "#" + id + self.instance; }); if(!this.options.cssSelectorAncestor) { this.options.cssSelectorAncestor = this.cssSelector.interface; } jQuery(this.cssSelector.jPlayer).jPlayer(this.options); jQuery(this.cssSelector.interface + " .jp-previous").click(function() { self.playlistPrev(); jQuery(this).blur(); return false; }); jQuery(this.cssSelector.interface + " .jp-next").click(function() { self.playlistNext(); jQuery(this).blur(); return false; }); }; Playlist.prototype = { displayPlaylist: function() { var self = this; jQuery(this.cssSelector.playlist + " ul").empty(); for (i=0; i < this.playlist.length; i++) { var listItem = (i === this.playlist.length-1) ? "<li class='jp-playlist-last'>" : "<li>"; listItem += "<a href='#' id='" + this.cssId.playlist + this.instance + "_item_" + i +"' tabindex='1'>"+ this.playlist[i].name +"</a>"; // Create links to free media if(this.playlist[i].free) { var first = true; listItem += "<div class='jp-free-media'>("; jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. if(first) { first = false; } else { listItem += " | "; } listItem += "<a id='" + self.cssId.playlist + self.instance + "_item_" + i + "_" + property + "' href='" + value + "' tabindex='1'>" + property + "</a>"; } }); listItem += ")</span>"; } listItem += "</li>"; // Associate playlist items with their media jQuery(this.cssSelector.playlist + " ul").append(listItem); jQuery(this.cssSelector.playlist + "_item_" + i).data("index", i).click(function() { var index = jQuery(this).data("index"); if(self.current !== index) { self.playlistChange(index); } else { jQuery(self.cssSelector.jPlayer).jPlayer("play"); } $(this).blur(); return false; }); // Disable free media links to force access via right click if(this.playlist[i].free) { jQuery.each(this.playlist[i], function(property,value) { if(jQuery.jPlayer.prototype.format[property]) { // Check property is a media format. jQuery(self.cssSelector.playlist + "_item_" + i + "_" + property).data("index", i).click(function() { var index = $(this).data("index"); jQuery(self.cssSelector.playlist + "_item_" + index).click(); jQuery(this).blur(); return false; }); } }); } } }, playlistInit: function(autoplay) { if(autoplay) { this.playlistChange(this.current); } else { this.playlistConfig(this.current); } }, playlistConfig: function(index) { jQuery(this.cssSelector.playlist + "_item_" + this.current).removeClass("jp-playlist-current").parent().removeClass("jp-playlist-current"); jQuery(this.cssSelector.playlist + "_item_" + index).addClass("jp-playlist-current").parent().addClass("jp-playlist-current"); this.current = index; jQuery(this.cssSelector.jPlayer).jPlayer("setMedia", this.playlist[this.current]); }, playlistChange: function(index) { this.playlistConfig(index); jQuery(this.cssSelector.jPlayer).jPlayer("play"); }, playlistNext: function() { var index = (this.current + 1 < this.playlist.length) ? this.current + 1 : 0; this.playlistChange(index); }, playlistPrev: function() { var index = (this.current - 1 >= 0) ? this.current - 1 : this.playlist.length - 1; this.playlistChange(index); }, supplied: "mp3", addMedia: function(media){ this.playlist.push(media); this.playlistNext(); } }; }); var last_el=''; jQuery('.track .wrap .play').click(function(){ var cur_img = jQuery(this).css('backgroundImage'); if(cur_img.substring(cur_img.length-10)=='play.png")'){ if(last_el!=''){ last_el.css('background-image','url("img/play.png")'); } var el = jQuery(this); last_el = el; parent.frames[1].addSong(el.attr("title"),el.attr("mp3"),el.attr("ogg")); el.css('background-image','url("img/pause.png")'); }else{ parent.frames[1].pauseSong(); } }); jQuery('.jp-interface .jp-pause').click(function(){ last_el.css('background-image','url("img/play.png")'); }); jQuery('body a').click(function(){ var el = jQuery(this); var href = el.attr('href'); if(href.substring(0,1)=='/'){ parent.location.href = parent.location.href + href.substring(1,href.length); } }); //]]> </script> hey there, i am making a slideshow site, a user can add effects to pictures using a drop down menu and choose a sound to accompany picture when the slideshow runs. i have hit a snag, my function is taking in the choice from the user for both sounds, but playing them over one another, i think its something silly im missing out. here is the function where i think im going wrong: Code: function EvalSound() { var sound1 = document.getElementById("sound1"); var choice = sound1.options[sound1.selectedIndex].value; var sound2 = document.getElementById("sound2"); var choice2 = sound2.options[sound2.selectedIndex].value; var pic1 = document.getElementById("first_pic"); var pic2 = document.getElementById("second_pic"); soundManager.play(choice); soundManager.play(choice2); } Thanks for any help I have a self project I am exploring. I would like to play a simple sound file each time a function is run. The function runs every second, so, basically, I am just trying to get an audible click sound file to run every time the function runs. I do not know how to play a sound file thru javascript. Any ideas? Here is the code file thus far... Code: <html> <head> <title>Timer</title> <link href="timer.css" rel="stylesheet" type="text/css" /> <embed src="click.wav" autostart=false hidden=true name="sound1" enablejavascript="true"> <script type="text/javascript"> var seconds = 0; var clockId; var running = false; function runClock() { seconds++; document.timer.timerClock.value = seconds; } function startClock() { if (!running) { clockId = setInterval('runClock()',1000); running = true; } } function stopClock() { if (running) { clearInterval(clockId); running = false; } } function resetClock() { document.timer.timerClock.value = 0; seconds = 0; } </script> </head> <body> <form id="timer" name="timer" action=""> <div id="header"> <p> <span>Timer<br /> </p> </div> <div id="intro"> <p>Click to begin timer</p> <p id="buttons"> <input onclick="startClock()" type="button" value="Begin Seconds Counter" /> <br /> <input name="timerClock" id="timerClock" value="0" /> <br /> <input onclick="stopClock()" type="button" value="Stop Timer" /> <br /> <input onclick="resetClock()" type="button" value="Reset Timer" /> </p> </div> </form> </body> </html> |