Solved

using onload in tpl file

Posted on 2006-06-28
7
442 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:RQuadling
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:RQuadling
ID: 17007871
I'm glad you got a good response.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Introduction HTML checkboxes provide the perfect way for a web developer to receive client input when the client's options might be none, one or many.  But the PHP code for processing the checkboxes can be confusing at first.  What if a checkbox is…
These days socially coordinated efforts have turned into a critical requirement for enterprises.
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

757 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

Need Help in Real-Time?

Connect with top rated Experts

19 Experts available now in Live!

Get 1:1 Help Now