SitePoint Sponsor

User Tag List

Results 1 to 1 of 1
  1. #1
    SitePoint Member
    Join Date
    Nov 2007
    Posts
    8
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Need help modifying Javascript 4 web class

    Hi all. I am new to this forum.
    I am taking some classes in web design.
    I don't know javascript as of yet, but have come across a script here that I would like to use. The script is:

    <script type="text/javascript" src="/external.js">
    </script>


    /* External part of the script */
    function externalLinks() {
    if (!document.getElementsByTagName) return;
    var anchors = document.getElementsByTagName("a");
    for (var i=0; i<anchors.length; i++) {
    var anchor = anchors[i];
    if (anchor.getAttribute("href") &&
    anchor.getAttribute("rel") == "external")
    anchor.target = "_blank";
    }
    }
    window.onload = externalLinks;



    <a href="document.html" rel="external">external link</a>




    I want to be able to use this script, but I need it modified to allow me to set the new windows size. Can somebody please help with this?

    The reason that I ask is that when I add the above external javascript code into the head section it kills the rollover functions of my in-line javascript. I found the script below that lets you modify the size of the window, but want to know if somebody could combine the parts of the script that allow you to set the window size with the script that I listed above because the 1st script is standards compliant.

    Here is the second script (That lets you specify window size):

    <a href="images/dollar.gif" alt="picture of a silver dollar" target="new" onclick="w=window.open(this.href,'new','left=0,top=0,width=305,height=387,status=0');w.focus();return false;"><img src="images/dollar_coin_example.gif" alt="picture of a dollart coin" width="139" height="139"></a>

    Also, If I use this as an external javascript, but already have another inline javascript, how do I make sure that one script does not conflict with another.

    Thanks in advance.
    E
    Last edited by Palzo; Nov 17, 2007 at 22:56. Reason: Added more info, Please help


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
  •