Results 1 to 2 of 2

Thread: Newbie...

  1. #1
    Join Date
    Feb 2007
    Posts
    3
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Newbie...

    Hey,

    I'm new to javascript and coding and html and all that fancy jazz. I've kinda been teaching it to myself as I go along, so when I hit a snag I'll wrack my brain for hours in utter frustration and despair until I realize that it was a misplaced comma or something.

    Anyway, I'm having an issue with some javascript code that I got from one o' dems free code websites. It's supposed to be a simple clickable slideshow that will redirect customers to certain pieces of jewelry when they click on a certain picture of the show. I want the page to open up in a new window, which it currently does. However, it's opening up in a new window that has no address bar or anything of the like. It's a simple problem that I know probably has a simple answer, but I've been tearing my hair out for two days trying to sort this thing out myself. I figure I'd better ask people who know more.

    Here's the code I'm using. You might see where I've tried to make a few adjustments and forgot to change it back. (ie: the places that make you go "lolz n00b")

    if(!window.JSFX)
    JSFX = new Object();

    document.write('<STYLE TYPE="text/css">.slideTrans{ filter:revealTrans(duration=1,transition=0) }</STYLE>');
    document.write('<STYLE TYPE="text/css">.slideBlend{ filter:blendTrans(duration=1) }</STYLE>');

    JSFX.ClickableSlide = function(theImg, theUrl, theTarget)
    {
    this.theImg = theImg;
    this.theUrl = theUrl == null ? "#" : theUrl;
    this.theTarget = theTarget == null ? "_blank" : theTarget;
    this.loadImg = new Image();
    }
    JSFX.ClickableSlideShow = function()
    {
    this.id = JSFX.ClickableSlideShow.getId();
    this.timeId = null;
    this.imgName = this.id + "_I";
    this.urlId = this.id + "_U";
    this.currSlide = 0;
    this.slides = new Array();
    this.startDelay = 0;
    this.slideDelay = 3000;
    this.transType = 24;
    this.transDuration= 1;

    window[this.id] = this;
    }
    JSFX.ClickableSlideShow.slideNo = 0;
    JSFX.ClickableSlideShow.getId = function() {return "JSFX_cs_" + JSFX.ClickableSlideShow.slideNo++;}
    JSFX.ClickableSlideShow.prototype.addSlide = function(theImg, theUrl, theTarget)
    {
    this.slides[this.slides.length]=new JSFX.ClickableSlide(theImg, theUrl, theTarget);
    }
    JSFX.ClickableSlideShow.prototype.setStartDelay = function(startDelay) {this.startDelay = startDelay*1000;}
    JSFX.ClickableSlideShow.prototype.setSlideDelay = function(slideDelay) {this.slideDelay = slideDelay*1000;}
    JSFX.ClickableSlideShow.prototype.setTransType = function(transType) {this.transType = transType;}
    JSFX.ClickableSlideShow.prototype.setTransDuration = function(transDuration) {this.transDuration = transDuration;}
    JSFX.ClickableSlideShow.prototype.setTimeout = function(f, t) {return setTimeout("window."+this.id+"."+f, t);}

    JSFX.ClickableSlideShow.prototype.toHtml = function()
    {
    return('\
    <IMG SRC="'+this.slides[0].theImg+'" \
    NAME="'+this.imgName+'" \
    class="slide'+(this.transType==24?"Blend":"Trans")+'" \
    alt="Click to see this product">');
    }
    JSFX.ClickableSlideShow.prototype.setSlide = function()
    {
    var img = document.images[this.imgName];
    if(img.filters != null)
    {
    if(this.transType < 24) img.filters[0].Transition=this.transType;
    img.filters[0].Duration = this.transDuration;
    img.filters[0].apply();
    }
    img.src = this.slides[ this.currSlide ].theImg;
    if(img.filters != null)
    img.filters[0].play();
    }

    JSFX.ClickableSlideShow.prototype.animate = function()
    {
    this.currSlide = (this.currSlide + 1) % this.slides.length;
    this.setSlide();
    this.timeId = this.setTimeout("animate()", this.slideDelay);
    }
    JSFX.ClickableSlideShow.prototype.start = function()
    {
    for(var i=0 ; i<this.slides.length ; i++)
    this.slides[i].loadImg.src = this.slides[i].theImg;
    var theImg = document.images[this.imgName];
    theImg.onmouseup = this.clickFn;
    theImg.ss = this;
    this.timeId = this.setTimeout("animate()", this.startDelay + this.slideDelay);
    }
    JSFX.ClickableSlideShow.prototype.clickFn = function()
    {
    var ss = this.ss;
    var slide = ss.slides[ss.currSlide];
    if( slide.theTarget.charAt(0) =="_blank")
    {
    if(slide.theTarget == "_blank")
    window.open(slide.theUrl, ss.id);
    else
    document.location = slide.theUrl;
    }
    else
    {
    if(this.nw && !this.nw.closed) this.nw.close();
    this.nw=window.open(slide.theUrl, ss.id, slide.theTarget);
    this.nw.focus();
    }
    }

  2. #2
    Join Date
    Mar 2005
    Location
    SE PA USA
    Posts
    30,495
    Thanks
    82
    Thanked 3,449 Times in 3,410 Posts
    Blog Entries
    12

    Default

    The code does look confused but, the only thing in it that could open a window with no address bar is this line:

    Code:
    this.nw=window.open(slide.theUrl, ss.id, slide.theTarget);
    If you were to change that to:

    Code:
    this.nw=window.open(slide.theUrl, ss.id);
    it would open a normal new window.
    - John
    ________________________

    Show Additional Thanks: International Rescue Committee - Donate or: The Ocean Conservancy - Donate or: PayPal - Donate

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •