Body onload.

HI all, first timer here..
Got a problem with <body onload="loadEvent()">
This works only when I remove the if statement found in loadEvent().
The if statement is to do some validation before enablin and disablin some form objects which is in her_my_future().
So basically it works without the if condition..
ANy clue:???
<jsp:useBean id="messageList" scope="session" class="manulife.sg.agenttools.common.MessageList" />
<%
String temp_pc = (String)session.getAttribute("plan_code");
String abc = "asd";
%>
<html>
<head>
<title>Individual Proposal - Rider</title>
<link rel="stylesheet" type="text/css" href="css/stylesheet.css">
<script language=Javascript src="/comprop/scripts/form_util.js">
</script>
<script>
function loadEvent(){
if(temp_pc == "WLW21"){
her_my_future();
}

String temp_pc is defined within a set of scriptlet tags.
Therefore, it is a Java variable and is not available
to your JavaScript script. If you check you will see
that it is "undefined" in JavaScript.
You must define and assign a value to temp_pc in JavaScript.
You can add it to your existing script like this:
<script>
var temp_pc = <%= temp_pc %>
function loadEvent()
     if(temp_pc == "WLW21")
          her_my_future();
</script>

Similar Messages

  • How to execute a javascript function in the body onload?

    Hi everyone!
    As you know in the HTML body attribute. You must specify the value of onload
    What is the correct sintaxis for execute a function since in the onload body?
    I only want to do some like this, but only I do it in APEX:
    <body onload ="javascript:namefunction();" >
    I do not know how to use #ONLOAD# when you using want to set some value.
    Could u help me please ?
    Any help would be very appreciated.
    Thank u in advance
    Best Regards

    Hi Chris
    Thank you for your help
    I tried with the next code but it doesn´t work.
    Do you know for what?
    Best Regards
    I paste the next code in the HTML Header :
    <head>
    <script language="JavaScript" type="text/javascript">
    function addLoadEvent(func){
    var oldonload = window.onload;
    if (typeof window.onload != 'function'){
    window.onload = func;
    else {
    window.onload = function() {
    oldonload();
    func();
    function ejecuta()
    doSubmit('ACEPTAR_R')
    addLoadEvent( ejecuta );
    </script>
    </head>

  • JSC - Javascript Exception in body onLoad

    I wasn't real sure where to post this question, but here goes:
    Does anyone know how I could perform a "less than" operation in Javascript in the <body onLoad=""> tag. I'm getting this error message:
    Exception Details: org.apache.jasper.JasperException
      /owner.jsp(13,363) The value of attribute "onload" must not contain the '<' character.Is there a built-in math library or something similar?
    Thanks.

    Hi
    Can you try with < for lessthan symbol.
    -Srinivas

  • My homepage has the following code: body onload="playSound('ding 2.wav')" .

    I have this code on my homepage: <body onload="playSound('ding 2.wav')">. It has worked on and off during all of the Firefox 4 betas, and now in the release, it doesn't work again. Is there some way I can get it to work consistently. It works consistently in 'Chrome' and 'IE9', but intermittently in Firefox. It seems that every time it got fixed in the beta, the next release would break it again.

    Can you post a link?<br />
    Do you specify a MIME type to make Firefox use a specific plugin?
    * WMP: type="application/x-mplayer2"
    A good place to ask questions and advice about web development is at the mozillaZine Web Development/Standards Evangelism forum.<br />
    The helpers at that forum are more knowledgeable about web development issues.<br />
    You need to register at the mozillaZine forum site in order to post at that forum.<br />
    See http://forums.mozillazine.org/viewforum.php?f=25

  • Body onload="..."  how can we access this type of functionality?

    Im working with a portlet, created in javascript. I would like to call a function when the portlet is first displayed (meant to populate a database driven list). However since the body onload event is not able to be modified from within a portlet, how can I accomplish this same type of functionality within plumtree?
    <body onload=".. :( ..">

    Because the portal page is a shared environment where several different portlets may all need to use the onload event handler, we cannot simply allow each portlet to register its own onload event handler.  Each would overwrite the other, and only the last portlet on the page would receive the benefit of using the onload event.
    To accommodate this, a client-side object called the PCC, short for Portlet Communication Component, exists to essentially &#034;multiplex&#034; a single onload event into multiple calls.  To take advantage of this functionality, you will need to register the function you want called with the PCC.
    Add a line of script to your portlet which looks something like:
    document.PCC.RegisterForEvent(namespaceURN, eventName, sFunction)
    namespaceURN = a namespace for your event, or just pass in false if you want to use the default window namespace.
    eventName = the event you want to register your function with, 'onload' in your case.
    sFunction = the name of your function, or an object reference to your function.

  • Body onload ()  for a JSP from portal

              Hi All,
              I am using weblogic workshop 8.1 and developing some jsps with rich netui custom
              tags. I have many portlets(contains JSPS) loaded in portal file. I want to call
              body onload() event from some JSP's. But, when load a portal file, the JSP's onload
              event is not getting fired.
              Can anybody help me in solving this problem?
              Thanks in advance.
              regards,
              Prashant
              

    Hi ,
              I think, It will be helpfull to you.
              <%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
              <%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
              <%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
              <body class='gs-IframeContainer-Body' onload="psButtonSrcInit('<bean:write name='commentsAttachmentsForm' property='buttonName' filter='true' scope='request' />', '<bean:write name='commentsAttachmentsForm' property='currentColumn' filter='true' scope='request' />'), parent.lsResizePage('<bean:write name='commentsAttachmentsForm' property='currentTarget' filter='true' scope='request'/>'), gsBusyStateCheckStateChange()" scroll='no'>
              Go through the link as I given below,In that you will find more information on this.
              http://javaboutique.internet.com/tutorials/InitForms/javascript.html
              ----Anilkumar kari

  • Need to find a work around body onload for use with wordpress

    I have this script that uses:
    <body onload="autoScroll('newsslider','newssection',5,true)">
    I use Wordpress and I need to find another way to make this work. I'm not familiar with javascript so I have no idea how to load this script in a different way.
    I've found tutorials but they just say use this bla bla.... you code goes here....bla bla bla...., any way very confusing.
    Can some one help me with this?
    Thanks

    Unless i insert at the right place in muse (like in a master page) the menu module tag generated by BC right?
    and for some obscure reason, i'm having a F*$*ing hard time to style
    this will need to be possible in Muse future, i know muse grid came with a BC blog Module, hopefully they will come up with a BC dynamic menu module.
    (sigh) ... i'm so discouraged
    y.

  • Afh:body onload

    Hi!
    I'm trying to execute a javascript method when the JSP page loads itself.
    The problem I have encountered is onload method doesn't has effect:
    The next line doesn't works:
    <afh:body binding="#{backing_a.body1}" id="body1" onload="javascript:probandoMensajes()">
    I have checked the function in javascript, and it's ok.
    Any ideas?
    Thanks in advance,
    Jaime.

    Hi,
    basically onload="javascript:probandoMensajes()" does call a method on the page root, using the browser URL (which I think is a detour that will never work sufficiently). If ever that works, then if using onload="javascript:document.probandoMensajes()".
    However, just adding onload="probandoMensajes()" should do it as well
    Frank

  • Problem with onload attribute in body tag

    hi all,
    i have been trying to test alert message boxes in servlets.when i am trying to run the servlet the alert window box doen;t appear (but it appears when i put "hello" inside the alertbrackets.and if i change it to some other text , it never appears.sounds silly , but pleas help me.
    please help me out. below is the code:
    public class TestApplet extends HttpServlet
         PrintWriter out = null;
         public void doPost (HttpServletRequest req, HttpServletResponse res) throws ServletException , IOException
              String strAlert = "alert('The userid is already existing.Please select another one')";
              out=res.getWriter();
              res.setContentType("text/html");
              out.println("<html>");
              out.println("<head>");
              out.println("<title>Welcome To Online Stock Market</title>");
              out.println("</head>");
              out.println("<body onload ="+strAlert+">");
              out.println("</body>");
              out.println("</html>");
              out.close();
         public void doGet(HttpServletRequest req, HttpServletResponse res)throws ServletException, IOException
              doPost(req, res);
    }

    Instead of:
    out.println("<body onload ="+strAlert+">");
    Try this:
    out.println("<body onload =\""+strAlert+\"">");
    Add two \" around the alert call.

  • Problem with onload on afh:body?

    Hallo,
    i think in my application afh:body onload="..." don't work.
    i use the following code but it don't work
    <afh:body onload="alert('Test');"> or <afh:body onload="Test();">
    in the second case i have a javascript function named Test.
    what is the problem?
    any help is appreciated.

    Hi,
    I found the reason.
    When adding alert("hello") to the onload property, then the following sorurce code is generated
    <afh:body onload='alert(\"hello\")'>
    Sometimes - and I cannot reproduce it consitently - it generates
    <afh:body onload='alert(\"hello)'>
    Which is invalid JavaScript
    Frank

  • Onload attribute of netui:body not working

    Is it so we cannot call onload attribute for Javscript function when we are using <netui:body>
    eg :: <netui:body onload="mycall()"> Not working.

    try this if you want to call a js function on body onload: I had found this solution from this news group some time back and it works great..
    change skin.properties. and add ur fn after initSkin();
    ex:
    document.body.onload: initSkin();myFunction();
    in skin.js add this function which calls your actualJSFuction().
    function myFunction()
    try
    actualJSFunction();
    catch(e)
    // do nothing
    Remember this gets called on load of every page.. so the trick is to add a try catch.. so that if the function not found in some pages they will go to catch block..
    Copy the actualJSFunction() in what all pages you need to call on body onload..
    In my case i am calling the actualJSFunction between <script> tags inside the page and not on body onload..
    Goodluck

  • Problem with javascript onload in apex page

    I want to run some javascript in APEX when the user loads the page, but I am having trouble getting the onload function to work. I’m new to javascript so it’s probably a simple mistake on my part .
    All I want to do is to change the background colour of a field (P5_GRPT) depending on the value of another field (P5_MIN_DAYS). I just want to get something basic that works then I can build on it and make it more elegant/generic, but at the moment the script below appears to have no effect whatsoever. Any help would be much appreciated. I have set the cursor focus attribute to “do not focus cursor” (Apex version 3.01.00.12)
    Page header html:
    <script type="text/javascript">
    Function trafficlight()
    c = document.getElementById("P5_MIN_DAYS").value;
    switch(c)
    case 1:
    $x("P5_GRPT").style.backgroundColor = "green";break;
    case 2:
    $x("P5_GRPT").style.backgroundColor = "yellow";break;
    default:
    $x("P5_GRPT").style.backgroundColor = "red";break;
    </script>Page html body:
    onload="trafficlight();"

    hi
    I'm new in apex 3.2 javasrcript and speak spanish
    i have function in html header
    <script language="JavaScript" type="text/javascript">
    function colorSal(pCol){
    var elms=document.getElementsByname(pCol);
    for (i=0; i< elms.length; i++){
    if (elms.value < 1500){
    elms[i].style.backgroundColor ='yellow';
    </script>
    and on body header:
    onload="colorSal ('f07');"
    This should change color column seven of tabular form but it does not happen .
    the query in tabular form is
    select
    "EMPNO",
    "EMPNO" EMPNO_DISPLAY,
    "ENAME",
    "JOB",
    "MGR",
    "HIREDATE",
    "SAL",
    "COMM",
    "DEPTNO",
    "MODIFIED_BY",
    "TICKED"
    from "#OWNER#"."EMP"
    thanks for your help

  • Problem with onload in jsp page

    Hi all,
    I had two jsp pages, a search and a results page. I need to enter some search criteria in the first page and based on that criteria i will be getting the results in the results jsp. Now, when i click the back button in the results page, i need to go to the search page and the values which i entered in the search page needs to be present there. But the problem is i had a javascript function which runs on loading of the search page. This function will set all the values in this search page to empty whenever we go to the search page. I am calling this javascript function as follows in my search jsp page.
    <body onload="setdefaultvalues('<%=name%>');">
    I am having the code for the back button in the results page as follows.
    <INPUT TYPE="button" VALUE='Back' onClick="javascript:history.go(-1);resetvalue(name);" class="button">
    The problem i am facing is whenever i go to the search page by clicking on the back button, the values in the search page are getting empty because of the onload method. There is no way that i can remove this onload method as i require it for setting the values in the search page evrytime i get to that from other modules as it is the main page for my module. So, is there anyway that i can stop this function from executing when i come from the results page or is there any other way that i can store the values in the search page when going from the results page.

    i think you really should have the result page include your search page contents rather than having the user need to click back as you'll end up with all sorts of nightmares in caching & session object management to be honest. if the search page is complex use javascript to hide contents and let the users expand them when they want to re-search.
    however, if you feel you must i would suggest the following:
    in your result page:
    session.setAttribute("userQuery","true"); (you probably actually want to put a container object with the query information in here)
    in your search page you could have something like:
    <body <% session.getAttribute("userQuery")==null { %>onload="setdefaultvalues('<%=name%>');"<% } %>>
    -or-
    <body onload="setdefaultvalues('<%=name%>',<%=session.getAttribute("userQuery")==null?"true":"false"%>);">
    function setdefaultvalues(name,run) { if ( !run ) return;....}
    you'll have to decide when to remove the object though cause once its set its there until the session expires or you remove it.
    hope that helps, good luck!

  • Onload event after all images are loaded in an updateContent area

    Hi Spry Folks!
    I load a template into a page with a lot of img tags inside
    it. Everything works fine.
    Spry.Utils.updateContent (...HTML wit lots of img tags...)
    But the loading takes a while so I would like to hide it
    until all the images are loaded. Now I need an event which fires
    after the loading bar in the browser is gone.
    The onPostLoad observer fires much to early, cause the code
    is long loaded bevore all the images
    (...addObserver({onPostLoad:...)
    Same with the window.onload event (...window.onload =
    showContent();...) fires much to early.
    The only thing which is working is placeing the function in
    the onload event of the body tag.
    Like:
    <body onload="showContent();">
    But there I can't use it. And there is now body.onload
    handler as far as I know there is only the windows.onload handler
    and I thought always this is the same event than onload in the body
    tag.
    Has anyone an idea? Is there a spry event I haven't found for
    exact this problem?
    Thanks for your help!
    regrads
    marcus

    Hello,
    U might want to look in to the SpryImageLoader.js that comes
    with the 1.6.1 download. It loads your images, and allows u put
    callbacks on them, and set priority of loading them.
    http://www.dbooth.net/photos/
    uses it to (expect don forgot to upload the
    SpryImageLoader.js thats why its not really working :P )
    But that will give the basic idea of how to use it.
    Spry.Utils.ImageLoader.(url, callback(needs to be a function
    or null), priority)

  • JSP + JScript + onLoad and return

    i have a return issue with a jsp as follows:
    =================================
    one jsp:A calls another jsp: B and is loaded into Frame1.
    a click event in the jsp B in Frame1 calls another jsp C (with the target specified as Frame2) which does the following:
    jsp C
    <html>
    <head>
    <script>
    function redirect(){
    parent.Frame1.location.href="http://myServer/final.jsp";
    return;
    </script>
    </head>
    <body onLoad="redirect()" >
    <% String Param1 = null; %>
    <% String Param2 = null; %>
    <% Param1 = request.getParameter("p1"); %>
    <% Param2 = request.getParameter("p2"); %>
    <% if(bookParam1 != null && bookParam2 != null){
    response.sendRedirect("/servlet/doSomething?p1=" + Param1 + "&p2=" + Param2);
    %>
    </body>
    </html>
    =======================================
    this jsp should onLoad load a jsp into Frame1 using the jscript function- then continue to action the java response.sendRedirect command which has a target of Frame2 as specified by jsp C.
    without the java code the jsp works
    BUT
    with the java code the onLoad method seems to be ignored and the sendRedirect loads into Frame2.
    any ideas why or how i can get both to work? i tried addding the "return" keyword but to no avail.
    (using apache / tomcat)

    the reason may be that the java code is executed before javascript is called because JavaScript is executed on the Client while Java is executed on the server.

Maybe you are looking for

  • Tried to install Firefox 8.0, it says I have a newer version, but have a 3.6.24. How come?

    When I use Firefox (3.6.24) I get a page saying I need the newest version, 8.0. I download the new one, move the file from "Fetched files" and put it on my desk, where I open it. As I, in dialogue field, drag Firefoxsymbol over to Applications map, i

  • Windows 8 USB recovery fails with CTOERROR.flg error

    Windows 8 recovery using HP supplied USB recovery device failed with CTOERROR.flg error. [22:53:29.29] ChkErrBB.CMD : Detect some error during PININST_BBV. [22:53:29.31] ChkErrBB.CMD : Check c:\system.sav\logs\BurnBootWarn.log [22:53:29.31] ChkErrBB.

  • BPM Process does not show newly added task

    I added a new task to my current BPM Process which has several tasks already built into it and they work when deployed. When I execute the workflow and get to that step, I get the following message: Details not available for this task. I am using jDe

  • Error code -1303. what can I do to fix this?

    My father bought a used ipod classic 80G 2 days ago. I hooked the ipod up to my itunes and restored it. As i was loading music to it, I realized that the music was not loading and I got a error code -1303. I restored the ipod again, same thing happen

  • Clip to Clipboard

    I have created a PDF file with password protection. The Clip to Clipboard is grayed out but I can highlight it and copy it. Why? I am viewing the file in Adobe Reader 9.1.3