new window problem

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • nameno
    New Member
    • Mar 2008
    • 2

    new window problem

    i have the following code ..witch will change the background off my page from files on my computer..but it opens a new window to do it .
    Can it be made to change the background on the same window ??

    <HTML>
    <HEAD>
    <TITLE> New Document </TITLE>

    <script>
    function display_image(i mage) {
    myWindow = window.open("", "Preview", "toolbar=0,loca tion=0,director ies=0,status=0, menubar=0,scrol lbars=0,resizab le=1,copyhistor y=0,width=1024, height=768,targ et=_parent" );
    myWindow.docume nt.open();

    myWindow.docume nt.write("</HEAD><BODY BACKGROUND=" + image + "><center><br>< br><br>");
    }
    </script>

    </HEAD>
    <link href="style.css " rel="stylesheet " type="text/css" />
    <center>
    <BODY>
    <table border="2" width="100%" height="100%">
    <tr><td>
    <form>
    <p><input type="file" name="url"><br>
    <input TYPE="button" VALUE="Wallpape r"
    onClick="displa y_image(&quot;f ile:///&quot;+document .forms[0].url.value)"> </p>
    </form>

    </td>
    </tr>
    </table>
    </BODY>
    </center>
    </HTML>
  • hsriat
    Recognized Expert Top Contributor
    • Jan 2008
    • 1653

    #2
    Here is a good example which can help you.

    Comment

    • nameno
      New Member
      • Mar 2008
      • 2

      #3
      thanks ..managed to make it open in the same page ,but now i have another problem..

      is there a way to strech the images automaticly according to the table size ?/?

      Comment

      • hsriat
        Recognized Expert Top Contributor
        • Jan 2008
        • 1653

        #4
        Originally posted by nameno
        thanks ..managed to make it open in the same page ,but now i have another problem..

        is there a way to strech the images automaticly according to the table size ?/?
        I think you may not do that with background image. But with the <img>, you can do that by changing its width attribute

        Comment

        Working...