Jump to content

building object in array


sfraise

Recommended Posts

I have an array but I'm not exactly sure how to finish the build using an if statement. I have 6 arrays and need the build to load a different top image for each array that loads that matches the specific array. Here is what I have but it only shows the first top image no matter what:

<LINK REL=StyleSheet HREF="scrolling_popup/scrolling_popup.css" TYPE="text/css">
    <script type="text/javascript" language="javascript" src="scrolling_popup/scrolling_popup.js"></script>
    <script type="text/javascript" >
        var array = new Array();
        array[0]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/1.jpg" border="0" alt=""></a>';
        array[1]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/2.jpg" border="0" alt=""></a>';
        array[2]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/3.jpg" border="0" alt=""></a>';        
        array[3]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/4.jpg" border="0" alt=""></a>';
        array[4]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/5.jpg" border="0" alt=""></a>';        
        array[5]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/6.jpg" border="0" alt=""></a>';
        var num=Math.floor(Math.random()*(array.length) );      
        var html_code = array[num];
        if (array[0]) {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code);
}
        else if (array[1]) {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop2.png">', html_code);
}
        else if (array[2]) {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop3.png">', html_code);
}
        else if (array[3]) {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop4.png">', html_code);
}
        else if (array[4]) {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop5.png">', html_code);
}
        else {
buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop6.png">', html_code);
}

    </script> 

Link to comment
Share on other sites

I have an array but I'm not exactly sure how to finish the build using an if statement. I have 6 arrays and need the build to load a different top image for each array that loads that matches the specific array. Here is what I have but it only shows the first top image no matter what:

I'm sorry, but what you said there makes no sense. Also, it's not 6 arrays. It's 1 array with 6 elements.

Link to comment
Share on other sites

Sorry, let me try to explain what I'm shooting for...

I have AN array with 6 objects in it that loads randomly on page load.

What I want to do is have a certain buildpopup_htmlcode build the loaded array.

For example, if array[1] is loaded I want

buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code);

to be used, if array[2] is loaded I want

buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop2.png">', html_code);

to be used, and so on.

 

Does that make any more sense?

Link to comment
Share on other sites

Why not remove the <a href='...'></a> part in the 6 strings? As far as I see, the links don't change. Just store the URL to the image like this:

 

var array = new Array();
array[0]='http://www.oohya.net/geoip/p/1.jpg" border="0" alt="">';
array[1]='http://www.oohya.net/geoip/p/2.jpg" border="0" alt="">';

 

Do that for all of them. Then after this line:

var html_code = array[num];

 

Put this:

buildPopup_HtmlCode(390, 329, html_code, '<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank">' + html_code + '</a>);

 

Then remove all those if, else and else if because you don't need them. That's it.

Link to comment
Share on other sites

Thanks ken2k7, but that still doesn't solve the problem of matching the appropriate build with the matching array element.

The point of the if/else is to try and load the different buildPopup_HtmlCode with the matching array element.

 

What I need is

buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code);

to be used with

array[0]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/1.jpg" border="0" alt=""></a>';

And

buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code);

to be used with

array[1]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/2.jpg" border="0" alt=""></a>';

And so on.

What's happening here is the array element calls the main body image of the popup with the outbound link, and the 'image' in the build is the top image that corresponds with the title section of the popup with the close out function from the js file. So when it's all put together it displays the top image as the title with the close "x" so when clicked the popup closes, and the the main body image is displayed with the outbound link so when clicked it's taken to the other site.

|=title===X| - buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code);

|                |

|    body    | - array[0] which calls the main body image and out bound link.

|_________|

 

Regardless of how the link is called, whether in the build or in the element, I still need to figure out how to get the appropriate build with the matching array element.

Link to comment
Share on other sites

Oh, use this:

buildPopup_HtmlCode(390, 329, '<img src="' + html_code + '" alt="" />', '<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank">' + html_code + '</a>);

Link to comment
Share on other sites

Maybe it will help if I give the js file code so you can see how the js is being built, the thing to look at is

function buildPopup_HtmlCode(width, height, title, htmlCode) which is how it's pulling from the script on the page. So in my actual script code I have

buildPopup_HtmlCode(390, 329, '<img src="http://www.oohya.net/geoip/images/imtop1.png">', html_code); where 390 width, 329 is height, img src is title, and htmlcode is what's pulling from the array. This method shows the same image in the title for all array elements, what I want to do is show a matching title image for it's related array element.

Here is the js code:

// float directions
var leftRight = 1;
var rightLeft = 2;
var topDown = 3;
var bottopUp = 4;

// side
var leftSide = 1;
var rightSide = 2;

// position
var topCorner = 1;
var bottomCorner = 2;

// default title
var _title = '';

// default width
var popupWidth = 390;
var popupHeight = 302;

var only_once_per_browser = false;

var ns4 = document.layers;
var ie4 = document.all;
var ns6 = document.getElementById&&!document.all;
var crossobj;

function getCrossObj()
{
    var contentDiv;
    var titleDiv;
    
    if (ns4)
    {
        crossobj = document.layers.postit;
        contentDiv = document.layers.postit_content;
        titleDiv = document.layers.postit_title;
    }
    else if (ie4||ns6)
    {
        crossobj = ns6? document.getElementById("postit") : document.all.postit;
        contentDiv = ns6? document.getElementById("postit_content") : document.all.postit_content;
        titleDiv = ns6? document.getElementById("postit_title") : document.all.postit_title;
    }   
    crossobj.style.width = popupWidth + 'px';
    crossobj.style.height = popupHeight + 'px';
    
    // adjust the size of the div "content"
    contentDiv.style.width = (popupWidth- + 'px';
    contentDiv.style.height = (popupHeight-26) + 'px';
    
    // adjust the width of the div "title"
    titleDiv.style.width = (popupWidth- + 'px';
    
}

//
//  buildPopup_Frame
//  passing it the url of the frame to display inside
//
function buildPopup_Frame(width, height, title, framesrc)
{
    if (width)
        popupWidth = width;
       
    if (height)
        popupHeight = height;
        
    if (title)
        _title = title
    

    document.write('<div id="postit" class="postit" >');

    document.write('<div id="postit_title" class="title"><b>' + _title + ' <span class="spantitle"><img src="close.gif" border="0" title="Close" align="right" WIDTH="11" HEIGHT="11" onclick="closeit()"> </b></span></div>');
    document.write('<div id="postit_content" class="content">'); 

    document.write('<iframe src="' + framesrc + '" width="100%" height="100%" marginwidth="0" marginheight="0" hspace="0" vspace="0" frameborder="0" scrolling="no" bordercolor="#000000"></iframe>');

    document.write('</div></div>');
    
    getCrossObj();
}

//
//  buildPopup_HtmlCode
//  build popup passing it the html code to put inside
//
function buildPopup_HtmlCode(width, height, title, htmlCode)
{
    if (width)
        popupWidth = width;
       
    if (height)
        popupHeight = height;

    if (title)
        _title = title

    document.write('<div id="postit" class="postit">');

    document.write('<div id="postit_title" class="title"><b>' + _title + ' <span class="spantitle"><img src="http://www.oohya.net/scrolling_popup/close.png" border="0" title="Close" align="right" WIDTH="13" HEIGHT="13" onclick="closeit()"> </b></span></div>');
    document.write('<div id="postit_content" class="content">'); 

    document.write(htmlCode);				

    document.write('</div></div>');

    getCrossObj();
}

//
//  closeit
//
function closeit()
{
    if (ie4||ns6)
        crossobj.style.visibility="hidden";
    else if (ns4)
        crossobj.visibility="hide";
}

//
//  get_cookie
//
function get_cookie(Name) 
{
    var search = Name + "=";
    var returnvalue = "";

    if (document.cookie.length > 0) 
    {
        offset = document.cookie.indexOf(search);
        if (offset != -1) 
        { 
            // if cookie exists
            offset += search.length;
            // set index of beginning of value
            end = document.cookie.indexOf(";", offset);
            // set index of end of cookie value
            if (end == -1)
                end = document.cookie.length;
            returnvalue=unescape(document.cookie.substring(offset, end));
         }
    }
    return returnvalue;
}

//
// check the cookie
//
function showOrNot(direction)
{
    var showit = false;
    
    if (get_cookie('postTheBoxDisplay')=='')
    {
        showit = true;
        document.cookie = "postTheBoxDisplay=yes";
    }
    return showit;
}

//
//  showItRight
//
function showIt(direction)
{
    var steps;
    
    steps = Math.floor(popupHeight / 4)+5;
  
    
    if (ie4||ns6)
    {
        crossobj.style.visibility = "visible";
        if ((direction == rightLeft) || (direction == leftRight))
            flyTheBox(direction, 0, popupWidth , steps, 1000);
        else 
            flyTheBox(direction, 0, popupHeight , steps, 1000);
    }
    else if (ns4)
        crossobj.visibility = "show";
}

//
//  flyTheBox
//
function flyTheBox(direction, start, end, steps, msec, counter)
{
if(!counter)
	counter = 1;

var tmp;

if(start < end)
{
    if (direction == rightLeft)
        crossobj.style.width = end / steps * counter + 'px'; 
    else if (direction == bottopUp)
        crossobj.style.height = end / steps * counter + 'px'; 
    else if (direction == topDown)
        crossobj.style.top = ((end / steps * counter) - popupHeight) + 'px'; 
        else if (direction == leftRight)
        crossobj.style.left = (end / steps * counter)-popupWidth + 'px'; 
        
    }
else 
{ 

    tmp=steps -	counter; 
    if (direction == rightLeft)
        crossobj.style.width = start / steps * tmp + 'px'; 
    else if (direction == bottopUp)
        crossobj.style.height = start / steps * tmp + 'px'; 
    else if (direction == topDown)
        crossobj.style.top = ((end / steps * counter) - popupHeight) + 'px'; 

} 
if(counter != steps) 
{ 
    counter++; 
    flyTheBox_timer=setTimeout('flyTheBox('+ direction + ',' + start + ','+ end + ',' + steps + ',' + msec + ', '+ counter + ')', msec/steps); 
} 
else 
{ 
    if(start > end)
		crossobj.style.display = 'none';
}
}


//
// ShowTheBox
//
function ShowTheBox(only_once, side, corner, direction)
{
    if (side == leftSide)
    {
        if (direction == rightLeft)
            return;
        crossobj.style.left = '1px';
    }
    else
    {
        if (direction == leftRight)
            return;
    crossobj.style.right = '1px'; 
    }

    if ((corner == topCorner) && (direction == bottopUp))
        return;

    if ((corner == bottomCorner) && (direction == topDown))
        return;
        
    if ( (direction == topDown) && (corner == topCorner) )
        crossobj.style.top = '-' + popupHeight + 'px';    
    else if ( ((direction == rightLeft)||(direction == leftRight)) && (corner == topCorner) )
        crossobj.style.top = '1px';
    else if (corner == bottomCorner)
        crossobj.style.bottom = '2px';

    if (only_once)
        only_once_per_browser = only_once;
  
    if (only_once_per_browser)
    {
        // verify the presence of a cookie
    if (showOrNot())
        showIt(direction);
    }
    else
    setTimeout("showIt("+ direction + ")",1030);
}

Link to comment
Share on other sites

Here's something I've tried which works, however being random the loaded title image doesn't match it's related htmlcode image. I have no idea of a way to get the arrays to load synchronized.

<LINK REL=StyleSheet HREF="scrolling_popup/scrolling_popup.css" TYPE="text/css">
    <script type="text/javascript" language="javascript" src="scrolling_popup/scrolling_popup.js"></script>
    <script type="text/javascript" >
        var array = new Array();
        array[0]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/7.jpg" border="0" alt=""></a>';
        array[1]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/8.jpg" border="0" alt=""></a>';
        array[2]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/9.jpg" border="0" alt=""></a>';        
        array[3]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/10.jpg" border="0" alt=""></a>';
        array[4]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/11.jpg" border="0" alt=""></a>'; 
        array[5]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/12.jpg" border="0" alt=""></a>';
        var num=Math.floor(Math.random()*(array.length) );      
        var html_code = array[num];
        array[0]='<img src="http://www.oohya.net/geoip/images/imtop1.png">';
        array[1]='<img src="http://www.oohya.net/geoip/images/imtop2.png">';
        array[2]='<img src="http://www.oohya.net/geoip/images/imtop3.png">';
        array[3]='<img src="http://www.oohya.net/geoip/images/imtop4.png">';
        array[4]='<img src="http://www.oohya.net/geoip/images/imtop5.png">';
        array[5]='<img src="http://www.oohya.net/geoip/images/imtop6.png">';
        var numb=Math.floor(Math.random()*(array.length) );      
        var title = array[numb];
        buildPopup_HtmlCode(390, 302, title, html_code);

</script>

 

If I could somehow sync the two sets of arrays I would be perfect, or even better somehow find a way to load the two images in the same array.

Link to comment
Share on other sites

It doesn't work.

I'm not exactly sure how you're building the actual array, if you're using one single array or using two arrays together? I'm assuming you're using 1 array by the looks of it in which case I leave the first 6 strings as is and then add the other 6 strings for the title right after the first existing strings using the same array[0], array[1], etc at which point it breaks the code. If I continue the count instead of starting over such starting the title array strings at array[6] then it screws would use the new strings as more html_code vars. If your intention is to replace my current 6 strings with what you gave me then we never assign the body image and would end up loading the title image as the title and the body.

 

Just so I'm clear, there's two separate images that need to load in conjunction with each other, one set of images are the title portion of the popup box and the other is the main body image. The title must load separate from the body as the close function overlays on that image and should not be hyperlinked like the main body is. If you look in the code I just posted using the two array's the top array is setting up the html_code variable which is the main body image of the popup, and the second array is setting up the title image variable. The build function then designates the height(390), width(302), title image(title), and body image(html_code). The only problem with the script I just posted is there is no way to ensure a particular title image loads with a particular body image, the overall popup needs to generate randomly which is where I run out of ideas on how to keep the two matching title and body images together. I've tried various ways to call the title var from within the html_code array strings with no luck and I've tried adding the title vars in strings within the same array as the html_code using various forms of title[num] with no luck. So far the above script is as close as I can get to a functional box with both images rotating, I just cant get them to match up while keeping the generation random.

Link to comment
Share on other sites

I think I could get this to work if there was a way to escape the comma in the array variables, however I can't find a way to escape them.

Here's what I want to use if there is a way to escape the commas:

<LINK REL=StyleSheet HREF="scrolling_popup/scrolling_popup.css" TYPE="text/css">
  <script type="text/javascript" language="javascript" src="scrolling_popup/scrolling_popup.js"></script>
  <script type="text/javascript" >
      var array = new Array();
    var html_code1='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/7.jpg" border="0" alt=""></a>';
    var html_code2='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/8.jpg" border="0" alt=""></a>';
    var html_code3='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/9.jpg" border="0" alt=""></a>';
    var html_code4='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/10.jpg" border="0" alt=""></a>';
    var html_code5='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/11.jpg" border="0" alt=""></a>';
    var html_code6='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/12.jpg" border="0" alt=""></a>';
    var title1='<img src="http://www.oohya.net/geoip/images/imtop1.png">';
    var title2='<img src="http://www.oohya.net/geoip/images/imtop2.png">';
    var title3='<img src="http://www.oohya.net/geoip/images/imtop3.png">';
    var title4='<img src="http://www.oohya.net/geoip/images/imtop4.png">';
    var title5='<img src="http://www.oohya.net/geoip/images/imtop5.png">';
    var title6='<img src="http://www.oohya.net/geoip/images/imtop6.png">';
        array[0]=title1, html_code1;
        array[1]=title2, html_code2;
        array[2]=title3, html_code3;
        array[3]=title4, html_code4;
        array[4]=title5, html_code5;
        array[5]=title6, html_code6;
        var num=Math.floor(Math.random()*(array.length) );
        buildPopup_HtmlCode(390, 302, array[num]);
        
</script>

Link to comment
Share on other sites

Ok, sorry for the continuation of my last thread but I want to narrow down a certain point if possible.

I want to know if it's at all possible to load two variables in an array string to be called separately.

Let me clarify, here is the following script I'm working on...

<LINK REL=StyleSheet HREF="scrolling_popup/scrolling_popup.css" TYPE="text/css">
  <script type="text/javascript" language="javascript" src="scrolling_popup/scrolling_popup.js"></script>
  <script type="text/javascript" >
      var array = new Array();
    var html_code1='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/7.jpg" border="0" alt=""></a>';
    var html_code2='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/8.jpg" border="0" alt=""></a>';
    var html_code3='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/9.jpg" border="0" alt=""></a>';
    var html_code4='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/10.jpg" border="0" alt=""></a>';
    var html_code5='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/11.jpg" border="0" alt=""></a>';
    var html_code6='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/12.jpg" border="0" alt=""></a>';
    var title1='<img src="http://www.oohya.net/geoip/images/imtop1.png">';
    var title2='<img src="http://www.oohya.net/geoip/images/imtop2.png">';
    var title3='<img src="http://www.oohya.net/geoip/images/imtop3.png">';
    var title4='<img src="http://www.oohya.net/geoip/images/imtop4.png">';
    var title5='<img src="http://www.oohya.net/geoip/images/imtop5.png">';
    var title6='<img src="http://www.oohya.net/geoip/images/imtop6.png">';
        array[0]=title1, html_code1;
        array[1]=title2, html_code2;
        array[2]=title3, html_code3;
        array[3]=title4, html_code4;
        array[4]=title5, html_code5;
        array[5]=title6, html_code6;
        var num=Math.floor(Math.random()*(array.length) );
        buildPopup_HtmlCode(390, 302, array[num]);
        
</script>

In the array strings I'm trying to load the title var and the html_code var to then be called randomly and outputted as

buildPopup_HtmlCode(390, 302, title#, html_code#);

The comma obviously throws the whole thing out of whack, I've tried using \, in it, I've tried "," in it, and I've tried title#+,+html_code# and nothing works. Of course I can call both variables and have both output using title#+html_code# however they both output together in the title section instead of the title being in the title section and the html_code being in the body section as it should be.

 

All I want to do is to get the title image and the matching html_code (body) image to load together while keeping the total call random. It seems like it would be simple in theory but damned if I can figure out how to get it to work. I've tried running two sets of arrays, one for the title and one for the html_code which works but I have no idea to get the matching title and html_code images to load together while still keeping the total output random with that method.

 

Anyone have any ideas on this? I'm sure there's a really simple way to achieve what I'm attempting, I just have no idea how to do it lol.

Link to comment
Share on other sites

Ok, looked at the thing with new eyes today and figured it out, was sooooo frickin simple lol.

Here's the proper script:

</script>
<LINK REL=StyleSheet HREF="scrolling_popup/scrolling_popup.css" TYPE="text/css">
    <script type="text/javascript" language="javascript" src="scrolling_popup/scrolling_popup.js"></script>
    <script type="text/javascript" >
        var array = new Array();
        array[0]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/7.jpg" border="0" alt=""></a>';
        array[1]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/8.jpg" border="0" alt=""></a>';
        array[2]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/9.jpg" border="0" alt=""></a>';
        array[3]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/10.jpg" border="0" alt=""></a>';
        array[4]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/11.jpg" border="0" alt=""></a>';
        array[5]='<a href="http://www.amateurmatch.com/in/?ainfo=MjI5MjR8Nnw3NDc=&atcc=0&_t=search3&id=489257" target="_blank"><img src="http://www.oohya.net/geoip/p/12.jpg" border="0" alt=""></a>';
        var array2 = new Array();
        array2[0]='<img src="http://www.oohya.net/geoip/images/imtop1.png">';
        array2[1]='<img src="http://www.oohya.net/geoip/images/imtop2.png">';
        array2[2]='<img src="http://www.oohya.net/geoip/images/imtop3.png">';
        array2[3]='<img src="http://www.oohya.net/geoip/images/imtop4.png">';
        array2[4]='<img src="http://www.oohya.net/geoip/images/imtop5.png">';
        array2[5]='<img src="http://www.oohya.net/geoip/images/imtop6.png">';
        var num=Math.floor(Math.random()*(array.length) );       
        var html_code = array[num]; 
        var title = array2[num];
        buildPopup_HtmlCode(390, 302, title, html_code);
</script>

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.