www.webdeveloper.com
Results 1 to 8 of 8

Thread: Help with Javascript:showimage

  1. #1
    Join Date
    Oct 2003
    Location
    Philadelphia, PA
    Posts
    4

    Help with Javascript:showimage

    I am trying to figure this out. I am trying to open a window with a set background and header for use with different pictures. It is very hard to explain but you can see a sample of this javascript at www.ehowa.com. The webmaster there makes it so when you click on a link to an image file a new window or page opens with his header and footer and that particular image in the middle. I think its amazing I cannot find ANY information on this and hope someone would help.
    Thanks

  2. #2
    Join Date
    Dec 2002
    Location
    Calgary, Canada
    Posts
    6,119
    There are tonnes of scripts out there,here is one of those,the iamge is opened with the window sized to exactly same as th eimages,you can change that and add header and footer..

    Click Here
    Cheers

    Khalid

    Message Posting Guidelines In These Forums, Please read these before posting any question.
    Web site: webapplikations.com
    Web Resources Page:Web Resources

  3. #3
    Join Date
    May 2003
    Posts
    42
    I have done something similar. From page one I open a new window with onclick ( I specify a window size and no tools or status) the on click gives an image name. The page specified in the window open parses the url for the img name . This page could have a header, footer or whatever.

    Calling code:
    Click on an image (could be text instead). These images are in a table for selecting what is to be viewed. The focus puts the new window on top and the return false keeps the calling page's postion from changing when moving to and from the calling window.

    <a href="#" onClick="window.open('display.html?yourimagename.jpg','display_2','resizable,scrollbars,width=540,he ight=470').focus();return false;"><img src="yourimagename.gif" height="110" alt="yourimagedescription"></a>

    Display page code:

    <html>
    <head>
    <title>
    Display Pics
    </title>

    <script language="JavaScript">

    var idx = document.URL.indexOf('?'); /*parameters on this URL? */
    var new_image = document.URL.substring(idx+1,document.URL.length);

    </script>

    </head>
    <body bgcolor="#8080ff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    <div align="center">

    <script language="JavaScript">
    document.writeln("<img src='"+new_image + "'>");
    </script>

    </div>
    </body>
    </html>


    Of course you will use the colors and text to suit your needs.
    Last edited by agminer; 10-28-2003 at 08:39 PM.

  4. #4
    Join Date
    Oct 2003
    Location
    Philadelphia, PA
    Posts
    4
    Im sorry but I cant get either one to work for me. Did you happen to check the example I gave?? agminer seems to have what I am looking for but I cant get it to work.

  5. #5
    Join Date
    May 2003
    Posts
    42
    Here is a page where I use the code

    http://home.mchsi.com/~barrs/made/made.html

    The display page code is a separate html page and the other code is placed in the main page. Hope this helps.

  6. #6
    Join Date
    Oct 2003
    Location
    Philadelphia, PA
    Posts
    4
    Well i would like to say thanks before anything.. I appreciate your time and help. But I altered the code from your page (I hope you dont mind) to see if I can get it to work for my needs. Here is the code Im using.

    <!doctype html public "-//w3c//dtd html 3.2//en">
    <html>
    <head>
    <title>
    Cards Made page 1
    </title>
    <meta name="GENERATOR" content="Arachnophilia 4.0">
    <meta name="FORMATTER" content="Arachnophilia 4.0">
    </head>
    <body bgcolor="#8080ff" text="#000000" link="#0000ff" vlink="#800080" alink="#ff0000">
    <br>

    <!script language="JavaScript">

    <a href="#" onClick="window.open('display.html?alivia.jpg','display_2','resizable,scrollbars,width=540,height=47 0').focus();return false;">OK</a>

    </body>
    </html>

    I have both html files and the image file in the same directory and everything works. Except the image will not show. It shows me a new window (PERFECT) but it only shows me the place holder for the image... The image does not load. Maybe you can check this code and let me know whats wrong. Thanks in advance.

  7. #7
    Join Date
    May 2003
    Posts
    42
    One of those quirks is that it won't work unless it is used from a web site. Upload it to a site them try it.
    Frustating to have to upload all the time to test it., but that is what I have to do (net and ie) both.

  8. #8
    Join Date
    Oct 2003
    Location
    Philadelphia, PA
    Posts
    4
    Hey AGMINER... I am posting this for no other reason than to thank you kindly for all your help. I now have it working exactly the way I want it to. Without your help I would be pulling my hair out. I REALLY appreciate you taking the time to help me. Thanks again.

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Posting Permissions

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



Recent Articles