Design Directory Discussion Forum Design Job Board Add Your Site Post a Message Post a Job / Gig

HomeDevelopers → Some Coding Help

Hello,

I was wondering if anyone could give me some help with some coding.Their are three things i wanna do:

1) I want to be able to load a web page so that it would change size, based on the users screen size.

2) I want to be able to load a new image after about 1minute, so that a new image is displayed without pressing the refresh button.

3) I also want to be able to let people click through the adds like a forward button and a rewind button

Any ideas, anyone

Thanks

MrSunshine

1 - you need to use relative sizes rather than absolute. so 90% rather than 760px and so on

2 - don't use it, but have this saved on my HD - if it doesn't appear right, email me and I'll send it that way - just don't ask how to configure it

----

<SCRIPT LANGUAGE="JavaScript">
<!--

//set image paths
src = ["1.jpg", "2.jpg", "3.jpg"]

//set corresponding urls
url = [" http://1.htm/ http://1.htm ", " http://2.htm/ http://2.htm ", " http://3.htm/ http://3.htm "]

//set duration for each image
duration = 3;

//Please do not edit below
ads=[]; ct=0;
function switchAd() {
var n=(ct+1)%src.length;
if (ads[n] &amp;&amp; (ads[n].complete || ads[n].complete==null)) {
document["Ad_Image"].src = ads[ct=n].src;
}
ads[n=(ct+1)%src.length] = new Image;
ads[n].src = src[n];
setTimeout("switchAd()",duration*1000);
}
function doLink(){
location.href = url[ct];
} onload = function(){
if (document.images)
switchAd();
}
//-->
</SCRIPT>

<A HREF="javascript:doLink();" onMouseOver="status=url[ct];return true;"
onMouseOut="status=''">
<IMG NAME="Ad_Image" SRC="1.jpg" BORDER=0>
</A>

------------

3 - you need to add buttons to the next and previous page where the ads are located [to the frame if using them]. or use flash

Can i just ask what the ahref part does, with the mouseover part does that mean everytime someone goes over the image then it will change?

Thanks



The HREF atribute tells the brorwser where the link is going so that when you click it the browser knows where to send you.
the script was originally designed to link to each of the images/or pages with them on. if you don't want links leave that bit out.
What about adding different tool tips to each image and also transitions/effects for when the images change?



javascript isn't not my thing, but its sounds as if you're in danger of making things a little to complicated and gimiky if all your posts are for the same site that is.
One other thing was the images were meant to be randomly selected not one after the other?

Thanks



http://www.amazon.co.uk/DOM-Scripting-Design-JavaScript-Document/dp/1590595335/sr=8-1/qid=1165999432/ref=pd_ka_1/202-6726474-3155016?ie=UTF8&amp;s=books" title="DOM Scripting DOM Scripting is an amazing book that teaches you all you'll ever need to know to get you started in the ways of JavaScript. You're always going to be better off doing these things yourself rather than try and get one of us to do it, that way you'll learn how it all works so you can modify it for future projects.