#1
  1. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Location
    San Jose, CA
    Posts
    58
    Rep Power
    14

    URL JavaScript Function


    I would like to call a function to open a new window and with the url in this code. I don't know how to call function in a href with in the href attribute? <A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\">"
    Here is the function thaqt I would like to call:

    <script language="JavaScript">
    <!--
    function MM_openBrWindow(theURL,winName,features) { //v2.0
    window.open(theURL,winName,features);
    }
    //-->
    </script>

    MM_openBrWindow('<?print"$popup";?>','shipwin','scrollbars=yes,resizable=yes,width=800,height=100,le ft=0,top=0');


    Code:
     if (db[i].URL == "" || db[i].URL == null) {
          Outline += " " + db[i].display      // no link, just a listed item  
          }
        else {
          Outline += " <A HREF=\"" + db[i].URL + "\" TARGET=\"" + top + "\">" + db[i].display + "</A>"
          }
    	// Bold if at level 0
        if (currIndent == 0) { 
          Outline = "<B>" + Outline + "</B>"URL == null) {
    Any help would be great!
    Thank you,

    Paul B Hepworth

    Questions & Answers http://www.lds.org
  2. #2
  3. T-Shirt Tragic
    Devshed Novice (500 - 999 posts)

    Join Date
    Mar 2001
    Location
    Melbourne, Australia
    Posts
    886
    Rep Power
    321
    you call a function in a href like this
    Code:
    <a href="&#106;avascript:myfunction()"></a>
    so I guess your Outline variable might look something like this:-
    Code:
    "<A HREF=\"&#106;avascript:MM_openBrWindow("+db[i].URL+",\'windowName\',\'windowFeatures\')\">"+ db[i].display + "</A>"
  4. #3
  5. No Profile Picture
    Contributing User
    Devshed Newbie (0 - 499 posts)

    Join Date
    Nov 2000
    Location
    San Jose, CA
    Posts
    58
    Rep Power
    14

    Thanks


    Thanks it worked well.

    I accually ended up using this:

    Code:
    
    "<A HREF=\"http://nextpage.com\" onClick=\"MM_openBrWindow("+db[i].URL+",\'windowName\',\'windowFeatures\')\">"+ db[i].display + "</A>"
    Thank you,

    Paul B Hepworth

    Questions & Answers http://www.lds.org

IMN logo majestic logo threadwatch logo seochat tools logo