table image change with java ..pls help

Discussion in 'JavaScript' started by nameno, Mar 8, 2008.

  1. #1
    i have this code..witch changes the background of my html..but i would like if possible..to change the background only to the table and not the whole page ..

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

    <SCRIPT LANGUAGE="Javascript">
    function bgl(){
    document.body.background = "file:///"+document.form.text2.value;
    }
    </SCRIPT>

    </HEAD>
    <link href="style.css" rel="stylesheet" type="text/css" />
    <center>
    <BODY>
    <table border="2" width="100%" height="100%">
    <tr><td>
    <FORM NAME="form">
    <INPUT TYPE="file" NAME="text2"><br>
    <INPUT TYPE="button" VALUE="wallpaper" onClick="bgl()"><BR>
    </form>

    </td>
    </tr>
    </table>
    </BODY>
    </center>
    </HTML>
     
    nameno, Mar 8, 2008 IP
  2. nameno

    nameno Peon

    Messages:
    2
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    0
    #2
    managed to do it .. but now the problem is it won`t strech the images acording to the table size ..anyway to do that ?
     
    nameno, Mar 9, 2008 IP
  3. lephron

    lephron Active Member

    Messages:
    204
    Likes Received:
    2
    Best Answers:
    0
    Trophy Points:
    53
    #3
    set the image width and height attributes to the same values as the tables
     
    lephron, Mar 9, 2008 IP