Solved

using onload in tpl file

Posted on 2006-06-28
7
447 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
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

Microsoft Certification Exam 74-409

Veeam® is happy to provide the Microsoft community with a study guide prepared by MVP and MCT, Orin Thomas. This guide will take you through each of the exam objectives, helping you to prepare for and pass the examination.

Question has a verified solution.

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

I imagine that there are some, like me, who require a way of getting currency exchange rates for implementation in web project from time to time, so I thought I would share a solution that I have developed for this purpose. It turns out that Yaho…
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 count occurrences of each item in an array.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

773 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