I now have the following script to generate a randomised listening test for students (I've removed some of the more elaborate features for the purpose of this thread).
Code:
<html>
<head>
</style>
[code]....
One thing that I have just now noticed (dunno how I missed it before) is that clicking on the link generates a new random link each time it is clicked. What I would really like is for people to be able to hear the same sound as many times as they want until e.g. they hit the browser refresh button.
For my website I would like to create a famous last words generator (randomized), and random page generator (within my site). What is the code for random quotes and random links?
I have a page on which a random image loads. Each image needs an accompanying image map to take you to the appropriate link. How do I make the appropriate image map links load? Here is my code so far, which works fine.
myStrip = new Array("images/hstrip_1.jpg","images/hstrip_2.jpg"); imgCt = myStrip.length;
function chooseStrip() { if (document.images) { randomNum = Math.floor((Math.random() * imgCt)); document.strip.src = myStrip[randomNum]; } }
This script produces 5 random images and works lika a dream. Im trying to figure out how to create links for each of the five rotating images, so the link would also rotate and reflect the new image? Code:
I've been looking everywhere for the answer to this problem- maybe your site and members is the one who can do it the random images are working as I want, EXCEPT, I want to make each one of these random images clickable to a url.It would be great if you knew. Also - if you know how to add a matching quote for each image right underneath it, that would be awesome, but having the clickable image is more important right now but I have not had any luck with matching up links and images in the 4 td cells.
On my website, I have random logos appear on the home page as products that I recommend. I would like to make these logos into links to the website they are from, so that when one clicks on the picture, it directs you to the site, but I can't quite get it to work, and I know very little about Javascript (as you may know from my previous question about Javascript).
Here's my current JS code:
<!-- // Set up the image files to be used. var theImages = new Array() // do not change this // To add more image files, continue with the
I have this script for putting up images at random, it works fine. I want to know how to put a link on each images, like if "image1.gif" is displayed, it links to "http://www.google.com", if "image2.gif" is displayed, it links to "hotmail.com", and so on. I attempted to figure out the problem myself, but the search was fruitless.
<script language="JavaScript"> <!-- function random_imglink(){ var myimages=new Array() myimages[1]="image1.gif" myimages[2]="image2.gif" myimages[3]="image3.gif" myimages[4]="image4.gif" myimages[5]="image5.gif" myimages[6]="image6.gif"
var ry=Math.floor(Math.random()*myimages.length) if (ry==0) ry=1 document.write('<img src="'+myimages[ry]+'" border=0>') } random_imglink() //--> </script>
I have a web page that contains a bunch of advertisements. What I need to do it randomly shuffle these images each time the page is refreshed. I cannot have any repeating ads.
I've been to many different site forums and have yet to have my questions answered completely maybe your site and members is the one who can do it.if you know how to add a matching quote for each image right underneath it, that would be awesome, but having the clickable image is more important right now.If its a new array, please show me exactly how it looks and where it goes in reference to this code if you'd be so kind.
What I have is a site with about 10 pictures, each of these pictures needs to be randomly pulled from folders, each picture slot will have its own folder, due to it being categorized. When the picture is clicked i need it to open a new page with the document associated to the picture. Is there a way to do this without having to rewrite the code every time? Because as there are new documents added at the end of each week.Unfortunately the server I use doesn't support PHP, but if it has to be done in PHP I can switch.Like I said though I haven't messed around with web design in a long time
I've been searching the net for a while, for the easiest multiple random images code and found it. But now I've also been searching for a script to link all single images to a different link (link z1.jpg to home.html, z2.jpg to contact.html, x1 to banana.html, etc.).
This is the script I'm using:
Code: <script language="javascript"> <!-- var gallery = new Array(); gallery[0] = new Array("z1.jpg","z2.jpg","z3.jpg","z4.jpg","z5.jpg");
Here is a script I found which works well for randomly selecting a static image when loading/refreshing a page, and allows captions for the images. I need this to also have the images link to other pages. I lack the javascript ability to do so.
Code:
<!DOCTYPE -don't forget to use one of these! <head> <title></title>
I need a script which click on random links on my webpage after page load?i have javascript code which open only link which i write in script but i want the code which click on any available link on my webpage the links change after every 10-15 seconds so i cant set a spacefic link in code...
I have found the code to move my objects around but I can't find a way of remembering the positions the objects were left at when I refresh the screen.
I would like my users to be able to move the layout around and have it save their layout so that the next time they view the website its as they left it.
The first thing I'd like to do is show/hide divs. What I'm going to do is pull out a few bits of PHP code out of the database and assign them all a class of show or hide. So, I need a script that can either open or close a div using a link using classes, probably with AJAX or DOM? The main thing is that it needs to be compatible with all major browsers. I've scoured the internet but can't find the most simple of scripts, and unfortunately my AJAX/DOM is terrible!
The second thing I need to do is remember which divs are open or closed. I was thinking of doing this with a database, and so I'll need to run a tiny PHP script to update the DB whenever a div is opened or closed. I assume this would be done using an onclick event? If so, I probably need to use GET to update the new class in the DB. Any ideas how I'd work out whether the div was open or not, and what function I'd use to run the PHP script?
Also, every time a page is loaded I'll get the 'show' or 'hide' options from the DB and assign them to the classes so the user still has their preferred tabs open.
Do many programmers remember most of the object properties and methods or do they use IDE or references to find those specific objects. I'm starting to learn Javascript and seeing all the different type of objects available can be depressing. :(
So I have this vertical menu with a few options. Originally it was pure CSS with a basic a:hover to change the background of the menu item. But then it was decided that whichever menu item you last had your mouse on should remain in that hover state.
So I went ahead an busted out some Javascript. Now I'm not exactly talented with Javascript as it's not one of my main languages. This is what I came up with.
The problem is: variable "mywin" is lost after i REFRESH the current page. Since i'm doing a LONG, LONG inventory management (where the opened window is about 200K long), I want to know how I can access the opened window. I tried searching the web, but as far as I know there isn't any "list of windows previously opened by this one" method or property.
I've managed to do it with a setTimeout function on the child window that calls another function of the parent window every 1/2 a second. Code:
The script below allows me to create expandable/collapsible menus. What I'm trying to figure out, and have been brutally unsuccessful thus far, is how to expand the menus upon an initial visit.
For example, on the home page, I have a link to "Colors" and a link to "Groceries". When a user clicks on "Colors, they are taken to a page with the collapsible menus: Colors GroceriesIf they were to click on Colors, the menu would expand and the user would see: Colors - Red - Blue - Yellow
GroceriesI want to make it so that if the user clicks on "Colors" from the home page, the "Colors" menu is automatically expanded on the page with the collapsible menus.
Haven't used cookies before really but I'd like to create a cookie that remembers the options a user has selected so they can have their styling next time they visit. The user selects the styles through 2 drop down boxes. Below are the drop down boxes for the information I would like the cookie to remember.
HTML Code: <script type="text/javascript"> function fontsize() { selectedstyle = document.form1.font.selectedIndex; newsize = document.form1.font.options[selectedstyle].value;
I know someone will enjoy rewritting this chunk of code for me and the community! It's a simply cookie to remember the position of an animated panel so it stays open (or closed) after a page reload. It is working*, but I am sure it can be shorte*Actually it's not perfect, when you close the panel you lose the button altogether until another page refresh! Long code that doesn't work!
I've got this javascript routine (i found on google) in an asp.net page that on page reload sets the cursor of a textbox to the last line. It works great!
Using a similar concept, I have another application that uses a textbox like an editor window and has a save and other buttons. Problem is - when I save/post/reload, the textbox returns to cursor the top again.
How can I preserve / save the exact cursor spot and return to the exact same spot I was in before I saved. Code:
I'm trying to use Javascript to have an array of images that load randomly AND work in a slideshow manner so change every 3 seconds (in a logical order). The code I have below presents a random image but how do I get them to continue from the random image and change to the next every 3 seconds?
I've looked for a solution to this issue, but it seems like a little different scenario than other situations. I made a system for generating friend requests on Facebook. I have a grid that is 6 x 3, for a total of 18 cells. Each cell has a picture in it, and the picture is linked to the Facebook friend request page. My problem is that since each cell is populated at random from the array, I'm getting lots of repeats. For example, some picutures are in 5 cells, and some are in none. I'm trying to figure out how to make it so that once a picture is used once in the grid, it does not get used again in the same grid.I still want every cell filled at random on each page load, I just want to prevent the repeating.
Here's my current code: <script type="text/javascript"> var vip_list=new Array( new Array('http://profile.ak.fbcdn.net/v225/1616/88/s1220771654_2158.jpg','http://www.facebook.com/addfriend.php?id=1220771654'), new Array('http://profile.ak.fbcdn.net/v223/1233/29/s904885342_9055.jpg','http://www.facebook.com/addfriend.php?id=904885342'),
I have a form that has a reset button, and when it's closed, the form is reset. However, at least in testing on my own machine, I notice that the form fields are remembering past input (on Firefox 4 anyway). Once this goes public, I don't want the form remembering anything in case the website is viewed on a public machine. How can I keep the form fields from remembering any past input?