?
Solved

using onload in tpl file

Posted on 2006-06-28
7
Medium Priority
?
464 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 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

Nothing in an HTTP request can be trusted, including HTTP headers and form data.  A form token is a tool that can be used to guard against request forgeries (CSRF).  This article shows an improved approach to form tokens, making it more difficult to…
Introduction This article is intended for those who are new to PHP error handling (https://www.experts-exchange.com/articles/11769/And-by-the-way-I-am-New-to-PHP.html).  It addresses one of the most common problems that plague beginning PHP develop…
The viewer will learn how to dynamically set the form action using jQuery.
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.
Suggested Courses

777 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