Random Link Not Working In IE?
Feb 7, 2010I recently used a random link generator found at http://javascriptkit.com in my webpage: http://random-casino.com
View 10 RepliesI recently used a random link generator found at http://javascriptkit.com in my webpage: http://random-casino.com
View 10 RepliesI am working on a website that uses a random header. I have been trying to figure out how to adjust the code so that the header also serves as a clickable link.
Here is the code that I have:
What do I need to add in order for the header to also serve as a link? I am completely new to JavaScript and I don't understand it very well.
How would I go about this? I found this piece of code, but this only allows
two links. Does anyone know how to expand on this to add 10 or more?
<script type="text/javascript">
var r=Math.random()
if (r>0.5)
{
document.write("<a href='http://www.w3schools.com'>Learn Web
Development!</a>")
}
else
{
document.write("<a href='http://www.refsnesdata.no'>Visit Refsnes
Data!</a>")
}
</script>
I have a problem with a random link generator within a DIV. When I try it on my desktop it works fine, but does nothing once I upload it to the website.how to explain what happens, but here is it, more or less:The website is this: http:[url]....
Via an Ajax script, http:[url]..... is loaded into DIV "menu". Here's the script:
<script type="text/javascript">
ajaxpage('menu.html', 'menu') //load "menu.html" into "menu" DIV
</script>
Well, there's another load of stuff inside the <head> tag. You may see it from the main page source code.Anyway, if you go to the menu.html, the link generator will work there as it is intended; however, if you try it from the main page, it won't do anything. But people are not suppossed to go to menu.html. They are suppossed to load it from the index.html (I mean, plain http:url....)So, here's the link generator code:
---------------------------------
<script type="text/javascript">
function randomlinks(){[code].....
I believe this could be solved if I could target the generator to the whole window, 'cause maybe it's trying to open the new page inside the DIV. Well, I don't know...
I used the code on this website [URL]... but it doesn't work. I have 167 links and placed the code correctly but nothing. What am I doing wrong?
View 3 Replies View RelatedI need a random JS script which stores a hyperlink around a designated image.
Let's say I've got a company website which offers various products, and on the front page I want a random image to appear of one of the products. When they click on that image, they are transfered to the page for that product. This means that the link and image has to correspond.
I have huge page of links, to whcih I am currently adding. I would
like to add a "random link" button which would parse the current page,
extract all URLs then load a random link.
I have this code which creates a text that redirects to a random post for a given feed URL (For blogger blogs)
<div id="myLuckyPost">
</div>
<script type="text/javascript">
function showLucky(root){ var feed = root.feed;
var entries = feed.entry || []; var entry = feed.entry[0]; for (var j = 0;
j < entry.link.length; ++j){if (entry.link[j].rel == 'alternate'){
window.location = entry.link[j].href;}}}
function fetchLuck(luck){ script = document.createElement('script');
script.src = '[URL]'; script.type = 'text/javascript';
document.getElementsByTagName('head')[0].appendChild(script);
} function feelingLucky(root){
var feed = root.feed; var total = parseInt(feed.openSearch$totalResults.$t,10);
var luckyNumber = Math.floor(Math.random()*total);luckyNumber++;
a = document.createElement('a'); a.href = '#random';
a.rel = luckyNumber; a.onclick = function(){fetchLuck(this.rel);};
a.innerHTML = 'View Random Post';
document.getElementById('myLuckyPost').appendChild(a); }
</script> <script src="[URL]">
</script>
How to use this generated random link individually as a variable. (Ex. I don't want to create a text that redirect me to the random post, I want to put it in a variable form to use it in another script). Like This:
var randompost = random post url here;
I'm trying to get a simple script to run where it cycles thru a few images with corresponding links and displays them on a page. I get the script to run 2 times then it breaks on the third with a runtime error saying "object expected Line 0". Code:
View 1 Replies View RelatedI've found a basic script, however I also need to add alt and title
attributes as well, how would I go about doing this? Code:
Reference website: Untitled Document.The above webpage contained simply javescript of random images in full screen & menu made by Sothink DHTML Menu.In Chrome & Firefox the content display perfectly with no issue. However, it's all blank or, only the menu showed up in IE6 & IE7. I am not sure in IE8 & IE9 as I don't have them.
View 3 Replies View RelatedAnother slightly different random image question. My coding is working fine in Safari (mac) but all that shows up in IE6 is the caption, not the image itself.
Code:
function randImgCap()
{
var banner = new Array();
banner[0] ="images/robpics/After_Fire.jpg"
banner[1] ="images/catepics/2tight.jpg"
[Code].....
I am trying to put an image on the front page of my website that changes to one of two random images on mouseover. This part was easy, and has been done (I got the code from [URL] But what I am finding difficult is to make each image link to a different page. For example, if the user mouseovers the main image and sees the 'thumbs up' image, then clicks on it, they should be taken to the 'thumbs up' page. And if the user mouseovers the main image and sees the 'thumbs down' image, then clicks on it, they should be taken to the 'thumbs down' page. The site is here: [URL] I think using 2 arrays is the way to go, but am not sure.
View 3 Replies View Related<html>
<body>
<div id="link">[code].........
I got stuck in getting this to work (show random element of the array as a link with description)
rl.innerHTML='<a href="addr[ri]">addr[ri]</a>';
This is showing addr[ri] on a page and directs to[url]....
I placed this code in an external js file. Nothing happens. What do I need to change?
varrandomPic = new Array();
randomPic[0] = "images/home/binoculars.jpg";
randomPic[1] = "images/home/conductor.jpg";
randomPic[2] = "images/home/dandelion.jpg";
[Code]....
Im trying to change the background on the "demo" div.
This works perfectly in Firefox and Chrome but sadly not in IE.
Code:
function getImage(){
var r = Math.floor(Math.random()*5);
var arrRotator = [];
arrRotator[0]="rotator1w.jpg";
[Code]....
This statement is to produce a random integer within a specified range. I get the desired result when passing the values within a function like this:
Code:
<html>
<script type="text/javascript">
function get_randomRange(low,high){
[code]...
the results form the second example look like the number are possibly being multiplied somewhere? why does the first example work and the second not?
I want to 'style' all links on my site with a variable for random colors. I got the variable for the random colors up and running but i can't figure out how to implement the variable to the css.
View 1 Replies View RelatedI'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?
<script language="JavaScript">
images = new Array(3);
images[0] = "<a href = 'photo1.html'><img src='images/photo1.jpg' alt='Photo 1'></a>";
images[1] = "<a href = 'photo2.html'><img src='images/photo2.jpg' alt='Photo 2'></a>";
images[2] = "<a href = 'photo3.html'><img src='images/photo3.jpg' alt='Photo 3'></a>";
[Code]...
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'),
[Code]...
I'm lost on why the "Become a Fan" link onhttp://ronisfineart.com/index.shtmlis not working or even visable onhttp://ronisfineart.com/sculpture.shtmlis it because of lightbox?)
View 1 Replies View RelatedFor 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?
View 2 Replies View RelatedI have a numbered image gallery which has a next and previous link which is another way of navigating through the gallery the problem i have that in IE all is fine but doesnt seem to be working in firefox, i would appreciate afew pointers,here is the code
<script type="text/javascript">
var currentImage = 1;
function LoadGallery(picNum, captionText)
[code].....
I have a few links on my website as follows: <a href="javascript:switchid('a6');">Link 6</a>but when I view source it comes out like this: <a href='javascript:switchid('>Link 6</a>
View 11 Replies View RelatedI have this JS.
function funcBut(){
document.getElementById('ref_button').innerHTML = 'pressed';
}
[code]....
I have some jquery functionality in place where by clicking on "more" a div replaces the old div. This works fine but I can#t seem to get the "previous" link to work, it simply refreshes the current content instead of replacing the div with the old one
HTML Code:
<script type="text/javascript" src="http://code.jquery.com/jquery-latest.js"></script>
<script type="text/javascript">
[code]....