Welcome to TalkGraphics.com
Results 1 to 10 of 10
  1. #1
    Join Date
    Nov 2008
    Posts
    11

    Default How Do I Avoid opening a New Window?

    I have created a button with mouse-over link with Webstyle.

    When the button is clicked, a new window is opened to show the linked page.

    My question is: how do I modify the Webstyle .js script so it won't open a new window? I believe I can change the 'target' commands or something...

    Any help from anyone? Thanks.

  2. #2
    Join Date
    Jul 2007
    Location
    Brockville, Ontario, Canada.
    Posts
    4,619

    Default Re: How Do I Avoid opening a New Window?

    Remove the target="_blank" statements
    Keith
    ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    There are 10 types of people in this world .... Those who understand binary, and those who don't.

  3. #3
    Join Date
    Nov 2008
    Posts
    11

    Default Re: How Do I Avoid opening a New Window?

    I have searched the js script created by Webstyle, but is unable to find the field you mentioned.

    If I can find it, I can try changing ot to "_top" in the target tag.

    Can anyone help me? Thanks.

    The script was created under the "buttons" design in Webstyle.

  4. #4
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: How Do I Avoid opening a New Window?

    Hello Rwon,

    Welcome to Talkgraphics.

    A test menu created on my system using Webstyle 4 will open the link in the same window when no Target Frame is entered.

    See attachment.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	webstyle4_target-frame.gif 
Views:	165 
Size:	45.9 KB 
ID:	53975  
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  5. #5
    Join Date
    Nov 2008
    Posts
    11

    Default Re: How Do I Avoid opening a New Window?

    Thank you , Sir, for your kind reply.

    As I have created the .js script with Webstyle 3, does anyone know how I can
    modify the code so it doesn't open a new window?

    If not, then I may have to fork out money to buy V4.

    Thank you.

  6. #6
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: How Do I Avoid opening a New Window?

    Rwon can you zip the .js file and attach it to a post here?
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  7. #7
    Join Date
    Nov 2008
    Posts
    11

    Default Re: How Do I Avoid opening a New Window?

    This is my "xxxxxx.js" file... thanks for your help in advance...

    var clicked=""
    var gtype=".gif"
    var selstate="_over"
    if (typeof(loc)=="undefined" || loc==""){
    var loc=""
    if (document.body&&document.body.innerHTML){
    var tt = document.body.innerHTML.toLowerCase();
    var last = tt.indexOf("refbuttons01.js\"");
    if (last>0){
    var first = tt.lastIndexOf("\"", last);
    if (first>0 && first<last) loc = document.body.innerHTML.substr(first+1,last-first-1);
    }
    }
    }

    document.write("<table border=\"0\" cellspacing=\"1\" cellpadding=\"0\"><tr>");
    tr(false);
    writeButton(loc+"","singmisc.php","main/refbutton01",220,90,"Singapore","Singapore",0);

    tr(true);
    document.write("</tr></table>")
    loc="";

    function tr(b){}

    function turn_over(name) {
    if (document.images != null && clicked != name) {
    document[name].src = document[name+"_over"].src;
    }
    }

    function turn_off(name) {
    if (document.images != null && clicked != name) {
    document[name].src = document[name+"_off"].src;
    }
    }

    function reg(gname,name)
    {
    if (document.images)
    {
    document[name+"_off"] = new Image();
    document[name+"_off"].src = loc+gname+gtype;
    document[name+"_over"] = new Image();
    document[name+"_over"].src = loc+gname+"_over"+gtype;
    }
    }

    function evs(name){ return " onmouseover=\"turn_over('"+ name + "')\" onmouseout=\"turn_off('"+ name + "')\""}

    function writeButton(urld, url, name, w, h, alt, target, hsp)
    {
    gname = name;
    while(typeof(document[name])!="undefined") name += "x";
    reg(gname, name);
    tr(true);
    document.write("<td>");
    if (alt != "") alt = " alt=\"" + alt + "\"";
    if (target != "") target = " target=\"" + target + "\"";
    if (w > 0) w = " width=\""+w+"\""; else w = "";
    if (h > 0) h = " height=\""+h+"\""; else h = "";
    if (url != "") url = " href=\"" + urld + url + "\"";

    document.write("<a " + url + evs(name) + target + ">");

    if (hsp == -1) hsp =" align=\"right\"";
    else if (hsp > 0) hsp = " hspace=\""+hsp+"\"";
    else hsp = "";

    document.write("<img src=\""+loc+gname+gtype+"\" name=\"" + name + "\"" + w + h + alt + hsp + " border=\"0\" /></a></td>");
    tr(false);
    }

  8. #8
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: How Do I Avoid opening a New Window?

    Hi rwon,

    I've looked at your javascript code and even installed Webstyle 3 on an older computer to make some tests.

    If you did not entry text into the Target Frame (Webstyle 3 and 4 have the same input fields) your links should open in the same window.

    If you did enter text and now wish to have the links open in the same window and you do not want to open your project in Webstyle 3 to edit. You can edit the javascript by adding one line of code.

    See the attached image to see where to add the line and what text to put into the line.

    The target should be two double quote marks with no space between them.

    After you edit the javascript and upload the file to your web server ensure you are not using a cache version of the page and then test the links. If they still open a new windows check your browser settings to be sure it is not setup to open all links in new windows. Also check with your web server provided to ensure they do not have a setting to open links in a new window.
    Attached Thumbnails Attached Thumbnails Click image for larger version. 

Name:	js_edit.gif 
Views:	129 
Size:	31.7 KB 
ID:	54031  
    Last edited by Soquili; 30 November 2008 at 02:15 PM. Reason: added information if new windows still opens
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

  9. #9
    Join Date
    Nov 2008
    Posts
    11

    Default Re: How Do I Avoid opening a New Window?

    Hi Bill,

    I appreciate your great help very much. Thanks for all the trouble you took.

    Thanks again.

  10. #10
    Join Date
    Nov 2000
    Location
    Red Boiling Springs TN USA
    Posts
    19,208

    Default Re: How Do I Avoid opening a New Window?

    You are very welcome. Glad to help.
    Soquili
    a.k.a. Bill Taylor
    Bill is no longer with us. He died on 10 Dec 2012. We remember him always.
    My TG Album
    Last XaReg update

 

 

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
  •