The forum of the forums
Welcome to the Official Support Forum of Forumotion!

To take full advantage of everything offered by our forum, please log in if you are already a member, or join our community if you've not yet.



Create a free forum like this one.

How to do this code to display two banners to each other?

Page 1 of 2 1, 2  Next

View previous topic View next topic Go down

Solved How to do this code to display two banners to each other?

Post by smurfavr on October 21st 2015, 5:11 am

How to do this code to display two banners to each other?




Code:
<div align="center">
                                   <script language="JavaScript">
<!--
function random_imglink(){
var myimages=new Array()

myimages[1]="http://i39.servimg.com"
myimages[2]="http://i38.servimg.com"
myimages[3]="http://i21.servimg.com"
myimages[4]="http://i58.servimg.com"
myimages[5]="http://i58.servimg.com"
myimages[6]="http://i19.servimg.com"
myimages[7]="http://i21.servimg.com"

var imagelinks=new Array()
imagelinks[1]="http://xxxxxxx"
imagelinks[2]="http://xxxxxxx"
imagelinks[3]="http://xxxxxxx"
imagelinks[4]="http://xxxxxxx"
imagelinks[5]="http://xxxxxxx"
imagelinks[6]="http://xxxxxxx"
imagelinks[7]="http://xxxxxxx"



var ry=Math.floor(Math.random()*myimages.length)

if (ry==0)
ry=1
document.write('<a href='+'"'+imagelinks[ry]+'"'+' target="_blank"><img src="'+myimages[ry]+'" border=0></a>')
}

random_imglink()
//-->
</script>
</div>


Last edited by smurfavr on October 26th 2015, 3:46 pm; edited 1 time in total

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by SLGray on October 21st 2015, 10:38 pm

You can use a table to have two images beside each other.


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36641
Reputation : 2441
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 22nd 2015, 3:31 am

I do not know how to do it.

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by SLGray on October 22nd 2015, 3:45 am

Code:
[table][tr][td][img]IMAGE URL[/img][/td]
[td][img]IMAGE URL[/img][/td]
[/tr]
[/table]


When your topic has been solved, ensure you mark the topic solved.
Never post your email in public.


SLGray
Administrator
Administrator

Male Posts : 36641
Reputation : 2441
Language : English
Location : United States

http://ztwds.forumotion.com/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 22nd 2015, 3:31 pm

I do not know how to do it. Can you do it in the code that I have given.

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 9:11 am

Up

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 9:47 am

Hi there,

Can you provide the two images? Links preferably.

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 12:29 pm




smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 12:37 pm

Where exactly are you going to display them?

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 12:51 pm

In the middle of my website.
http://smurfa.bulgarianforum.net/portal

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 12:54 pm

Here you are!

Code:
<table style="width: 100%;" cellpadding="5" cellspacing="5" border="0">
              
   <tbody>
      <tr>
              
         <td>
                <img src="http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif" /><br />   
         </td>
              
         <td>
                <img src="http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif" /><br />   
         </td>
              
      </tr>
           
   </tbody>
</table><br />

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 1:00 pm

I want to do in the code that I gave because I have many banners, which must be put.

http://help.forumotion.com/t143948-how-to-do-this-code-to-display-two-banners-to-each-other#982769

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 1:03 pm

But the thing I gave does work, yes? If so, how many more banners do you need?

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 1:08 pm

I have a 7 to 10 bars of different sites that have banner exchange. I want to use this code because it is a rotation of banners.

Code:
myimages[1]="http://i39.servimg.com"
myimages[2]="http://i38.servimg.com"
myimages[3]="http://i21.servimg.com"
myimages[4]="http://i58.servimg.com"
myimages[5]="http://i58.servimg.com"
myimages[6]="http://i19.servimg.com"
myimages[7]="http://i21.servimg.com"

var imagelinks=new Array()
imagelinks[1]="http://xxxxxxx"
imagelinks[2]="http://xxxxxxx"
imagelinks[3]="http://xxxxxxx"
imagelinks[4]="http://xxxxxxx"
imagelinks[5]="http://xxxxxxx"
imagelinks[6]="http://xxxxxxx"
imagelinks[7]="http://xxxxxxx"

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 1:10 pm

Yes, that is correct. I just tested that code with the two banners you gave me and it seemed to had worked just fine.

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 1:13 pm

This code currently working on my website, but I want to do it to display two banners because currently shows only one banner.

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Guest on October 24th 2015, 1:17 pm

Oh, now I understand. Okay, I'll see what I can come up with.

Guest
Guest


Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 24th 2015, 1:23 pm

ок

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 24th 2015, 1:34 pm

Hi @smurfavr,

Try this instead :
Code:
<script type="text/javascript">(function() {
  var _randomImages = [
    'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
    'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
  ];
 
  function _randomImage() {
    var index = Math.floor(Math.random() * _randomImages.length),
        img = _randomImages[index];
   
    _randomImages.splice(index, 1);
    return img;
  };
 
  document.write('<img src="' + _randomImage() + '"/><img src="' + _randomImage() + '"/>');
}());</script>

You can paste this wherever HTML and <script> formats, such as homepage message, widgets, or an html page. At the top you can indicate an image list, with multiple images being separated by a comma.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 25th 2015, 6:29 am

By pressing the banner does not open a new page to the site which is the banner.

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 25th 2015, 9:23 am

Replace the script with this :
Code:
<script type="text/javascript">(function() {
  var _randomImages = [
    'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
    'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
  ], _randomURLs [
    '',
    ''
  ];
 
  function _randomImage() {
    var index = Math.floor(Math.random() * _randomImages.length),
        img = _randomImages[index]
        url = _randomURLs[index];
   
    _randomImages.splice(index, 1);
    _randomURLs.splice(index, 1);
    return '<a href="' + url + '"><img src="' + img + '"/></a>';
  };
 
  document.write(_randomImage() + _randomImage());
}());</script>

I added _randomURLs so you can place the URL of the images. Make sure they're in the same order as the images they're related to.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 25th 2015, 2:04 pm


Correctly made code?
Code:
<script type="text/javascript">(function() {
  var _randomImages = [
    'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
    'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
  ], _randomURLs [
    'http://smurfa.bulgarianforum.net/',
    'http://smurfa.bulgarianforum.net/'
  ];
 
  function _randomImage() {
    var index = Math.floor(Math.random() * _randomImages.length),
        img = _randomImages[index]
        url = _randomURLs[index];
   
    _randomImages.splice(index, 1);
    _randomURLs.splice(index, 1);
    return '<a href="' + url + '"><img src="' + img + '"/></a>';
  };
 
  document.write(_randomImage() + _randomImage());
}());</script>

I did not understand where to put it.

1.HTML pages management
2.Javascript codes management
3.widget

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 25th 2015, 3:26 pm

It can go in a widget, html page, homepage message, etc. Since it includes the HTML <script> tag it shouldn't be placed in JS codes management.

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 25th 2015, 3:52 pm

I can not figure out how to do it. Google does not translate correctly. Grr

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 25th 2015, 4:01 pm

Anywhere HTML formats, except posts. ^^

1. HTML Pages management
2. Widget
3. Homepage message
4. Announcement

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Michael_vx on October 26th 2015, 8:39 am

hi sorry for jump in first
i tested the Code
Code:
<script type="text/javascript">(function() {
var _randomImages = [
'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
], _randomURLs [
'http://smurfa.bulgarianforum.net/',
'http://smurfa.bulgarianforum.net/'
];

function _randomImage() {
var index = Math.floor(Math.random() * _randomImages.length),
img = _randomImages[index]
url = _randomURLs[index];

_randomImages.splice(index, 1);
_randomURLs.splice(index, 1);
return '<a href="' + url + '"><img src="' + img + '"/></a>';
};

document.write(_randomImage() + _randomImage());
}());</script>
it wont show any thing im not sure is that my problem or there something missing i cant figure it on the Script
sorry for jumping in a topic dose not belong to me

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 26th 2015, 9:41 am

@Michael_vx you're right, I forgot a comma and an assignment operator. Shocked

I fixed it, so try now :
Code:
<script type="text/javascript">(function() {
  var _randomImages = [
    'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
    'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
  ], _randomURLs = [
    'http://smurfa.bulgarianforum.net/',
    'http://smurfa.bulgarianforum.net/'
  ];
 
  function _randomImage() {
    var index = Math.floor(Math.random() * _randomImages.length),
        img = _randomImages[index],
        url = _randomURLs[index];
   
    _randomImages.splice(index, 1);
    _randomURLs.splice(index, 1);
    return '<a href="' + url + '"><img src="' + img + '"/></a>';
  };
 
  document.write(_randomImage() + _randomImage());
}());</script>

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Michael_vx on October 26th 2015, 1:12 pm

Shocked
do my eyes got blind or im getting more stupid because i didnt figure the comma and an assignment operator places are
i think i have one last question
how many images can that Script handle and dose it work like slide or not thanks again and i good luck to the topic owner

Michael_vx
Forumember

Male Posts : 659
Reputation : 29
Language : Arabic and some English
Location : Egypt

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by smurfavr on October 26th 2015, 1:42 pm

@Ange Tuteur
Banners are displayed below each other. I want to show to each other.
Can you do it by clicking the banner to open a new page.
Can you add banners to be displayed on a rotating basis.

He had those things in the code that I have given in my first post.

smurfavr
Active Poster

Male Posts : 1416
Reputation : 11
Language : Bulgarian

http://smurfa.bulgarianforum.net/

Back to top Go down

Solved Re: How to do this code to display two banners to each other?

Post by Ange Tuteur on October 26th 2015, 2:17 pm

Replace the code with this :
Code:
<script type="text/javascript">(function() {
  var _randomImages = [
    'http://i58.servimg.com/u/f58/16/34/78/03/sait-g11.gif',
    'http://i58.servimg.com/u/f58/16/34/78/03/new-ne11.gif'
  ], _randomURLs = [
    'http://smurfa.bulgarianforum.net/',
    'http://smurfa.bulgarianforum.net/'
  ];
 
  function _randomImage() {
    var index = Math.floor(Math.random() * _randomImages.length),
        img = _randomImages[index],
        url = _randomURLs[index];
   
    _randomImages.splice(index, 1);
    _randomURLs.splice(index, 1);
    return '<a href="' + url + '"><img src="' + img + '"/></a>';
  };
 
  document.write('<div id="randomBanner">' + _randomImage() + _randomImage() + '</div>');
}());</script>

and then add 1 of the following CSS codes to your stylesheet.

If you want the images to fit side-by-side regardless of resolution :
Code:
#randomBanner img {
  width:50%;
}

If you want a scroll bar :
Code:
#randomBanner  {
  width:100%;
  white-space:nowrap;
  overflow-y:auto;
}

Ange Tuteur
Forumaster

Male Posts : 13028
Reputation : 2704
Language : EN10, FR5
Location : Pennsylvania

http://fmdesign.forumotion.com

Back to top Go down

Page 1 of 2 1, 2  Next

View previous topic View next topic Back to top


 
Permissions in this forum:
You cannot reply to topics in this forum