SitePoint Sponsor

User Tag List

Results 1 to 5 of 5

Hybrid View

  1. #1
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Oslo
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    How to trig a javascript

    Is there a way of trigging a javascript at the end of the <body> tag? Like this

    <html>
    <body>

    Do some html here

    <script type="text/javascript">
    How do I trig this script automaticly?
    </script>
    </body>
    </html>

  2. #2
    Sultan of Ping jofa's Avatar
    Join Date
    Mar 2002
    Location
    SvÝ■jˇ­
    Posts
    4,080
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Not sure I understand your question...

    "The onload event occurs when the user agent finishes loading a window..." (w3.org)

  3. #3
    SitePoint Addict ThomasAesir's Avatar
    Join Date
    May 2002
    Location
    Sydney, Australia
    Posts
    214
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    You mean to trigger?

    this will trigger javascript at the end of the body tag, if that's what you mean?

    <html>
    <body>

    Do some html here

    <script language="javascript">
    var q = "How do I trig this script automaticly?"
    document.write(q);
    </script>
    </body>
    </html>
    Thomas Oeser - Blueprint Software
    Web Scripting Editor v 5.2 One cool Web editing tool.
    3dcomputergraphics.com Coming Soon!

  4. #4
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Oslo
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Ok, check out this code:

    </html>
    <body>

    <form action="upload.php" method="post" name ="editForm" onload="insert()">

    <table border="0" width="100%" cellspacing="0" cellpadding="0" height="387">
    <tr>
    <td width="20%" height="21"></td>
    <td width="20%" height="25"><font face="Verdana, Arial, helvetica" size="2">Mods &nbsp;&nbsp;</font></td>
    <td width="20%" height="25"><input type="text" name="mods" size="20" value=""></td>
    <td width="20%" height="21"></td>
    <td width="20%" height="21"></td>
    </tr>
    </table>
    </form>

    <script type="text/javascript">
    function insert()
    {
    document.editForm.mods.value = "<?echo "$mods";?>"
    }
    </script>

    </body>
    </html>

    How can I make text appear in 'mods' by using javascript (and php)? The onload method doesn't seem to work.....
    Last edited by Pompiuses; Jun 27, 2002 at 01:07.

  5. #5
    SitePoint Zealot
    Join Date
    May 2002
    Location
    Oslo
    Posts
    138
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    ok figured it out..... it was my PHP script that messed it all up


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
  •