473,796 Members | 2,788 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Could use some help with a link problem.

Amy
Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why? Please let me
know, thanks, Amy
one that works by day just following and works correctly. <BODY
onload="changel ink();"><a href="#" id="url"></a>

var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];

now = new Date();
nowDate = now.getDate();
function changelink(){
if (nowDate*2 arr.length) return;
document.getEle mentById("url") .href = arr[nowDate*2-1][0];
document.getEle mentById("url") .appendChild(do cument.createTe xtNode(arr[nowDate*2-2][0]));
}
The following works by milliseconds. It only switches from the left
item to the right item
but left item isn't a link to the right item like it is supposed to be.
Can anyone help me fix it? Thank you very much. <BODY
onload="changel ink();"><a href="#" id="url"></a>
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
var dynLink = null;

function init() {
dynLink = document.getEle mentById('url') ;
window.setTimeo ut('changeURL(0 )',1000);
}

function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.innerHT ML = arr[i][0];
dynLink.href = arr[i][1];
window.setTimeo ut('changeURL(' +(++i)+')',1000 );
}
window.onload = init;

Nov 3 '06 #1
8 1232
Lee
Amy said:
>
Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why?
>var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
>function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.innerHT ML = arr[i][0];
dynLink.href = arr[i][1];
window.setTimeo ut('changeURL(' +(++i)+')',1000 );
}
window.onloa d = init;
Ask your instructor to explain arrays more clearly.
You don't seem to understand what these mean:
arr[i][0]
arr[i][1]
--

Nov 4 '06 #2
Amy
Can't you just tell me what you're trying to say, many of us don't have
instructors, I did a google search and I still don't know how to fix
it.
Lee wrote:
Amy said:

Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why?
var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.innerHT ML = arr[i][0];
dynLink.href = arr[i][1];
window.setTimeo ut('changeURL(' +(++i)+')',1000 );
}
window.onload = init;

Ask your instructor to explain arrays more clearly.
You don't seem to understand what these mean:
arr[i][0]
arr[i][1]
--
Nov 5 '06 #3
ASM
Amy a écrit :
Can't you just tell me what you're trying to say, many of us don't have
instructors, I did a google search and I still don't know how to fix
it.
ask to google : javascript array two dimensions
>Amy said:
>>Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why?
var arr = [
[["Link name google web site"],["http://www.google.com"]],
[["two link"],["http://www.yahoo.com"]]
];
>>function changeURL(i) {
if (i >= arr.length) {
i = 0;
}
dynLink.inner HTML = arr[i][0];
dynLink.hre f = arr[i][1];
window.setTim eout('changeURL ('+(++i)+')',10 00);
}
window.onlo ad = init;
Ask your instructor to explain arrays more clearly.
You don't seem to understand what these mean:
arr[i][0]
arr[i][1]
--
Nov 5 '06 #4
ASM wrote:
Amy a écrit :
>Can't you just tell me what you're trying to say, many of us don't have
instructors, I did a google search and I still don't know how to fix
it.
I assume you didn't read my second post in your previous thread, then?

[snip]
var arr = [
[["Link name google web site"],["http://www.google.com"]],
[["two link"],["http://www.yahoo.com"]]
];
That wouldn't be right, either.

[snip]

Mike
Nov 5 '06 #5

Amy wrote:
Hello this script was switched to one with a timer. But now it doesn't
work right. The items in the left are supposed to be the link names,
and the items in the right are supposed to be the link addresses. When
it was switched from a day rotation to a timed rotation something is
keeping it from working as a link. Can anyone see why? Please let me
know, thanks, Amy
one that works by day just following and works correctly. <BODY
onload="changel ink();"><a href="#" id="url"></a>

var arr = [
["Link name google web site"],["http://www.google.com"],
["two link"],["http://www.yahoo.com"]
];
Your code wants an array of arrays, make the above an array by removing
the inner brackets (untested, but if the rest works...):

var arr = [
["Link name google web site","http://www.google.com"],
["two link","http://www.yahoo.com"]
];

--
Rob

Nov 5 '06 #6
ASM
Michael Winter a écrit :
ASM wrote:
>Amy a écrit :
>>Can't you just tell me what you're trying to say, many of us don't have
instructors , I did a google search and I still don't know how to fix
it.

I assume you didn't read my second post in your previous thread, then?
Witch my previous thread ?
>var arr = [
[["Link name google web site"],["http://www.google.com"]],
[["two link"],["http://www.yahoo.com"]]
];

That wouldn't be right, either.
Ooops ! (but, tested, it worked)

var arr = [
["Link name google web site","http://www.google.com"],
["two link","http://www.yahoo.com"]
];

not tested as is
Nov 5 '06 #7
ASM wrote:

[snip]
Witch my previous thread ?
This is a continuation of the thread entitled, "Please, how to add a
random function to this?"[1]

[snip]

Mike
[1] Please, how to add a random function to this?
Amy <ri*******@aol. com>
Fri, 3 Nov 2006 13:29:13 UTC
<11************ *********@b28g2 000cwb.googlegr oups.com>

<http://groups.google.c o.uk/group/comp.lang.javas cript/browse_thread/thread/906a73837c1de31 4/45f79ed9fa808ca 3>
Nov 5 '06 #8
Amy
I had to leave the other thread because my code wasn't working.

Thank you very much ASM for helping me, very much appreciated. Anywhere
I can send you some stuff? Amy

Nov 6 '06 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

5
2602
by: Sorby | last post by:
Hi I've been coding in PHP for a little while now and was starting to feel pretty confident but then realise I need to understand regular expressions to solve a particular problem I've got ... What a horrible can of worms regex is!! (to the uninitiated at least). I realise that if I spend the next few weeks researching regex I'll probably find the answer but I was wondering if anyone here would kindly help speed up the process?
5
32238
by: Subrahmanyam Arya | last post by:
Dear oracle gurus, I am unable to get past the error ORA-12154: TNS: could not resolve service name on my host when using hsodbc to talk to a remote mysql database. i got from the meta link all the needed documenatation to configure inithsodbc.ora,listener.ora,tnsnames.ora and related errors Here is what it says ORA-12154: SQL> select * from all_catalog@demo;
3
4710
by: Dante | last post by:
Tonight I started writing a script that places a "Copy All" link before every PRE tag. The link would copy the code in the pre tag. I can't get this script to work. Can anyone help me? Here is my script: function makeIt() { var where = document.getElementsByTagName("TABLE").childNodes.childNodes.childNodes.childNodes; var base = document.getElementsByTagName("PRE"); var link = document.createElement("SPAN"); var text =...
2
2044
by: dinks | last post by:
Hi, I'm new to C++ and have been assigned a task which i dont completely understand. Any help would be greately appreciated. Here is the problem: The class "linkedListType" use the "assert" facility. I am to get rid of them and replace them with exceptions. I need to create a "linkedListException" class that's declared and implemented in my "linkedListType" class. This class needs to inherit from the base "exception" class and return...
3
2627
by: Dai Ba Wong | last post by:
Hi: Currently I am having a problem with my webpage. My page consist of two frames, one consist of input text field and the other contains link for different pop-up windows. The problem follows: 1. At the beginning, focus is placed on an input text field of the first frame (so there's a blinking cursor on such field). 2. Then users click on a link of the second frame (thus focus is set
1
2565
by: Koen | last post by:
Hi all, I created a little database to manage my e-books. The program will synchronize a table with the contents of a directory. Works great. Because I keep additional info (like keywords) to the created records in the database and I don't want to lose all that info when I rename a file and synchronise, I've added some code to the program. It works like this: when the filename of a DB records
4
2752
by: jereme.goblue | last post by:
The web page at http://www.rossowinspections.com/ has an issue with the left menu. The left menu has 7 links. One of the links doesn't work. Using Firefox 1.5 the Fees link isn't a clickable link, if viewed as a full screen. If you shrink the window down the Fees link then becomes a link. The link works in IE and Mozilla. I've validated the CSS and XHTML, the CSS had no errors, the XHTML has no errors other than the paramaters for the...
1
2527
by: tccode97 | last post by:
Hi, I need an urgent help. I am developing a socket application in VC++ that uses asynchronous connnection. After doing search on google, I found the following link http://msdn2.microsoft.com/en-us/library/system.net.sockets.udpclient...
9
8849
by: Kernel Bling | last post by:
Hi Everyone, This Saturday the stage was set. The problem simply could not go on existing -- it had to be solved. Many hours, articles, compilations and frustrations later I still did not find an answer. Even pacing around my flat until I nearly went into an altered state of reality proved futile. So here is the problem... When I link up the ObjectDataSource UpdateMethod to a method in the
0
9685
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10461
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
10239
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10190
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
10019
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7555
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6796
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
2
3736
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2928
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.