SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Thread: JS help

  1. #1
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    JS help

    hello-

    i'm trying to get this script to have each thumbnail on my site open up in an html page, without making the html page for each thumnail.

    does this make sense?

    does the script?

    ---in head---
    <script language="javascript">
    <!--
    function OpenWin(URL){
    window.open(URL, 'picWin', '');
    }
    //-->
    </script>

    ---in body---
    <a href="java script:OpenWin('http://www.mysite.com/images/1.jpg')"><img src="images/pic1.jpg" width="77" height="50" border="0"></a>

    thanks.

  2. #2
    Prolific Blogger silver trophy Technosailor's Avatar
    Join Date
    Jun 2001
    Location
    Before These Crowded Streets
    Posts
    9,446
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not sure, but couldn't you just scrap the function def. and just do this:
    Code:
    <a href="window.open('http://www.mysite.com/images/1.jpg', Window Name)"><img src="images/pic1.jpg" width="77" height="50" border="0"></a>
    Sketch
    Aaron Brazell
    Technosailor



  3. #3
    SitePoint Enthusiast
    Join Date
    Feb 2001
    Posts
    58
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    not sure. i'm js illiterate.

    i'll try it out though.

    thanks.

  4. #4
    You talkin to me? Anarchos's Avatar
    Join Date
    Oct 2000
    Location
    Austin, TX
    Posts
    1,438
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Using a function is much better than writing it inline, plus you forgot j&#097;vascript: anyway. The first version looks good to me.
    ck :: bringing chris to the masses.

  5. #5
    What? Maelstrom's Avatar
    Join Date
    Oct 2001
    Location
    Whistler BC originally from Guelph Ontario
    Posts
    2,175
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Re: JS help

    [i]---in head---
    <script language="javascript">
    <!--
    function OpenWin(URL){
    window.open(URL, 'picWin', '');
    }
    //-->
    </script>

    ---in body---
    <a href="java script:OpenWin('http://www.mysite.com/images/1.jpg')"><img src="images/pic1.jpg" width="77" height="50" border="0"></a>

    thanks. [/B]
    Your script looks fine to me too. But being the picky person I am javascript wasn't suppost to be used like that (according to the tutorials and books I read anyways) try this

    Code:
    <a href="javascript:void(0)" onclick="OpenWin('http://www.mysite.com/images/1.jpg')">
    Its a little cleaner and uses the actual event handlers
    Maelstrom Personal - Apparition Visions
    Development - PhP || Mysql || Zend || Devshed
    Unix - FreeBSD || FreeBsdForums || Man Pages
    They made me a sitepoint Mentor - Feel free to PM me or Email me and I will see if I can 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
  •