?
Solved

using onload in tpl file

Posted on 2006-06-28
7
Medium Priority
?
483 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
5 Comments
 
LVL 49

Accepted Solution

by:
Roonaan earned 2000 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

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

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

Password hashing is better than message digests or encryption, and you should be using it instead of message digests or encryption.  Find out why and how in this article, which supplements the original article on PHP Client Registration, Login, Logo…
3 proven steps to speed up Magento powered sites. The article focus is on optimizing time to first byte (TTFB), full page caching and configuring server for optimal performance.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
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 …
Suggested Courses
Course of the Month14 days, 3 hours left to enroll

807 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