Solved

using onload in tpl file

Posted on 2006-06-28
7
457 Views
Last Modified: 2008-02-01
Hi There I need to use the onload function in a tpl file,

onclick, mouseover etc work but not onload,




<div id="Layer1">
          <table cellpadding="0" cellspacing="0" onload="dmxFPLP1('Layer1',0,0,0,0,10,0,0,2)" class="pBox" style="margin: 0">
            <tr>
              <td class="pBoxWTL"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
              <td class="pBoxT"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
              <td class="pBoxWTR"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
            </tr>
            <tr>
              <td class="pBoxL"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
              <td class="pBox"><p><b>{trim:screenname,20}</p>
                  <p style="text-align: center">
                    <!-- IF pending == "1" -->
                    <a href="{virtual_path}{picture_link}"><img src="{top.virtual_tpl_path}{top.loggedin_template}/media/pendingpicture.gif" alt="" border="0" /></a>
                    <!-- ELSEIF adult == "1" -->
                    <!-- IF loggedin_adult == "1" -->
                    <a href="{virtual_path}{picture_link}"><img src="{virtual_pic_path}{filename}" alt="" border="0" /></a>
                    <!-- ELSE -->
                    <a href="{virtual_path}{picture_link}"><img src="{virtual_tpl_path}{loggedin_template}/media/adultpicture.gif" alt="" border="0" /></a>
                    <!-- ENDIF -->
                    <!-- ELSEIF filename == "" -->
                    <img src="{virtual_tpl_path}{loggedin_template}/media/nopicture.gif" alt="" border="0" />
                    <!-- ELSE -->
                    <a href="{virtual_path}{picture_link}"><img src="{virtual_pic_path}{filename}" alt="" border="0" /></a>
                    <!-- ENDIF -->
                  </p>
                <table cellspacing="0" cellpadding="0" width="100%">
                    <tr>
                      <td class="psBox">Flirtatiousness</td>
                      <td class="psBox"><img src="{virtual_tpl_path}{loggedin_template}/media/stars{flirtatiousness}.gif" border="0" alt=""></td>
                    </tr>
                    <tr>
                      <td class="psBox">Approachability</td>
                      <td class="psBox"><img src="{virtual_tpl_path}{loggedin_template}/media/stars{approachability}.gif" border="0" alt=""></td>
                    </tr>
                    <tr>
                      <td class="psBox">Looking for fun</td>
                      <td class="psBox"><img src="{virtual_tpl_path}{loggedin_template}/media/stars{looking_for_fun}.gif" border="0" alt=""></td>
                    </tr>
                    <tr>
                      <td class="psBox">Looking for relationship</td>
                      <td class="psBox"><img src="{virtual_tpl_path}{loggedin_template}/media/stars{looking_for_relationship}.gif" border="0" alt=""></td>
                    </tr>
                </table></td>
              <td class="pBoxR"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
            </tr>
            <tr>
              <td class="pBoxWBL"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
              <td class="pBoxB"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
              <td class="pBoxWBR"><img src="{virtual_tpl_path}{loggedin_template}/media/empty.gif" width="1" height="1" border="0" alt=""></td>
            </tr>
          </table>
        </div>
0
Comment
Question by:buster808
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
7 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 500 total points
ID: 17007163
The onload event works only for the body and iframe tag. You can however also use:
<script type="text/javascript">
window.onload = function() {{template_var_for_onload_javascript});
</script>

-r-
0
 
LVL 29

Expert Comment

by:TeRReF
ID: 17007198
As far as I know, the onLoad function can only be used in the <body> tag...
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17007471
onLoad applies to ...

APPLET, EMBED, FRAMESET, IMG, LINK, SCRIPT, window

You could also use ...

window.addEventListener
      (
      'load',
      function() {{template_var_for_onload_javascript}},
      false
      );

0
 

Author Comment

by:buster808
ID: 17007523
Thanks Guys for your quick input,

Getting code into the body tag got the onload working in the tpl file.


First question ive asked at ee impressed with the response.

Ketan
0
 
LVL 40

Expert Comment

by:Richard Quadling
ID: 17007871
I'm glad you got a good response.
0

Featured Post

Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Deprecated and Headed for the Dustbin By now, you have probably heard that some PHP features, while convenient, can also cause PHP security problems.  This article discusses one of those, called register_globals.  It is a thing you do not want.  …
Developers of all skill levels should learn to use current best practices when developing websites. However many developers, new and old, fall into the trap of using deprecated features because this is what so many tutorials and books tell them to u…
The viewer will learn how to create and use a small PHP class to apply a watermark to an image. This video shows the viewer the setup for the PHP watermark as well as important coding language. Continue to Part 2 to learn the core code used in creat…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …

729 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question