View Single Post
Old 03-08-2003, 05:00 PM   #1 (permalink)
Admin
$_['Your_Mom'];
 
Admin's Avatar
 
Join Date: May 2002
Location: Santee
Posts: 627
Admin is on a distinguished road
javascript function help..

im trying to make something that will swap out text when you click on a link. check out this page: http://msnbc.com/news/842500.asp about 3/4 of the way down.

i have been messing with the javascript on that site trying to figure it out, but its burried inside of many many many functions so im having a hardtime figuring it out.

here is where i have gotten from messing with their script:

PHP Code:
<script language=javascript>
function 
Swapcopy(dataname,nNextPg){
    var 
oData = eval(dataname);
    if (!
oData.nCurPage) { oData.nCurPage 0; }
    if (
nNextPg == oData.length) { nNextPg 0; }
    if (
document.layers) {
        var 
PopObj = eval("document.layers['poptext_" +dataname"']");
        var 
PopObj2 = eval("document.layers['poptext_" +dataname"2']");

        
PopObj.layers[oData.nCurPage].visibility="hidden";
        
PopObj.layers[nNextPg].visibility="show";
        if (
PopObj2) {
            
PopObj2.layers[oData.nCurPage].visibility="hidden"
            
PopObj2.layers[nNextPg].visibility="show"
        }
    }
    else if (
oBr.ie4) { 
        var 
PopObj = eval("document.all.poptext_" +dataname)
        var 
PopObj2 = eval("document.all.poptext_" +dataname+"2")

        
PopObj[oData.nCurPage].style.display="none";
        if (
nNextPg > -1) { PopObj[nNextPg].style.display=""; }
        if (
PopObj2) { 
            
PopObj2[oData.nCurPage].style.display="none";
            
PopObj2[nNextPg].style.display=""
        }
    }
    else if (
oBr.ns6) { 
        var 
PopObj = eval("document.getElementById(\"poptext_" +dataname+"\").childNodes");
        var 
PopObj2 = eval("document.getElementById(\"poptext_" +dataname+"2\")");
        
PopObj.item(oData.nCurPage).style.display="none";
        
PopObj.item(nNextPg).style.display="";
        if (
PopObj2) { 
            
PopObj2.childNodes.item(oData.nCurPage).style.display="none";
            
PopObj2.childNodes.item(nNextPg).style.display=""
        }
    }
    if (
nNextPg > -1) { oData.nCurPage nNextPg; }
}
</script>

</HEAD>

<BODY>

<script language=javascript>
 Products = new Array();
var i=0;
 Products[i++] = "<b>Product 1:</b> This is product 1";

 Products[i++] = "<b><b>Product 2:</b> This is product 2";

 </SCRIPT>

<a href="javascipt:Swapcopy('Products',0);">Product 1 </a> <br>
<a href="javascipt:Swapcopy('Products',1);">Product 2 </a> <br> 
am i close? anyone know of a simpler funtion to do something like that?

any help would be appreciated
__________________


Urban Clothing
Admin is offline   Reply With Quote