Loading ...
Sorry, an error occurred while loading the content.

Re: IE dosn't recognize javascript in tab

Expand Messages
  • yaseminavcular
    Unfortunately I m working from home now and I can t publish from home. For now I could send the code. Do you have any suggestion for this browser problem?
    Message 1 of 5 , Jul 31, 2007
    • 0 Attachment
      Unfortunately I'm working from home now and I can't publish from home.
      For now I could send the code.
      Do you have any suggestion for this browser problem? Because
      everything is good with firefox, but IE doesn't recognize js..

      MAIN PAGE CODE

      YAHOO.example.init = function( ){
      tabView = new YAHOO.widget.TabView( { id: 'demo' } );

      panel_main.setBody("");

      YAHOO.util.Event.onContentReady('middlePanelBody', function() {
      tabView.appendTo(this); /* append to #middlePanelBody */
      });
      };

      function tabAdd(url){
      var myAjax = new Ajax.Request(
      url,
      {
      method:'post',
      parameters:'',
      onSuccess: showTab,
      onFailure: function(request){alert("error opening new tab");}
      });
      }

      function showTab(req){


      YAHOO.util.Dispatcher.delegate (new YAHOO.widget.Tab({
      label: 'inbound message',
      dataSrc: 'InboundMessage.do?method=query',
      cacheData: false, /* only load once */
      active: true
      }), tabView);

      }

      THE PAGE RETURNS FROM 'InboundMessage.do?method=query'

      <%@ page language="java" pageEncoding="UTF-8"%>
      <%@ taglib uri="/taglib/struts-html" prefix="html"%>
      <%@ taglib uri="/taglib/struts-bean" prefix="bean"%>

      <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"
      "http://www.w3.org/TR/html4/loose.dtd">

      <html>
      <head>
      <meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
      <title>Struts Form</title>

      <script type="text/javascript">

      tabName = "<%=request.getAttribute("tabName")%>";

      /******************************List**************************************/
      function list(){
      var url = 'InboundMessage.do?method=list'
      var myAjax = new Ajax.Request(
      url,
      {
      method: 'post',
      parameters: '',
      onComplete: showList,
      onFailure:function(request) { alert("error in list"); }
      });

      }
      function showList(req){
      tabView.get('activeTab').set('content', req.responseText)}
      /******************************List**************************************/

      function list(){
      alert("yasemin");
      }
      </script>

      </head>
      <body>
      <div id="formdiv">
      <html:form action="/Person">
      <input type="hidden" name="method" value="save" />
      <bean:message key="myForm.firstName" />
      <html:text property="firstName" />
      <br>
      <bean:message key="myForm.lastName" />
      <html:text property="lastName" />
      <br>
      <bean:message key="myForm.age" />
      <html:text property="age" />
      <br>
      <bean:message key="myForm.origin" />
      <html:text property="origin" />
      <br>
      <bean:message key="myForm.email1" />
      <html:text property="email1" />
      <br>
      <bean:message key="myForm.email2" />
      <html:text property="email2" />
      <br>
      <bean:message key="myForm.phoneNumber" />
      <html:text property="phoneNumber" />
      <p><bean:message key="myForm.sex" /><br>
      <html:radio property="sex" value="male">
      <bean:message key="myForm.sexMale" />
      </html:radio> <html:radio property="sex" value="female">
      <bean:message key="myForm.sexFemale" />
      </html:radio></p>
      <p><bean:message key="myForm.grade" /> <html:select
      property="grade">
      <html:option value="1">
      <bean:message key="myForm.01" />
      </html:option>
      <html:option value="2">
      <bean:message key="myForm.02" />
      </html:option>
      <html:option value="3">
      <bean:message key="myForm.03" />
      </html:option>
      </html:select></p>
      <p><bean:message key="myForm.areyousure" /><br>
      <input type="checkbox" name="sure" /> <bean:message
      key="myForm.imSure" /></p>

      <html:button property="prev"
      onclick="list();" >
      <bean:message key="myForm.list" />
      </html:button>

      <html:button property="add"
      onclick="j()" >
      <bean:message key="myForm.add2" />
      </html:button>
      </html:form>



      --- In ydn-javascript@yahoogroups.com, Caridy Patiño Mayea
      <caridy@...> wrote:
      >
      > Could you please publishing an example, and I'll check it out.
      >
      > Best Regards
      > Caridy (caridy at gmail.com)
      > http://bubbling.comarq.com/
      >
      > --- In ydn-javascript@yahoogroups.com, "yaseminavcular"
      > <yaseminavcular@> wrote:
      > >
      > > Okey :)
      > > Then I listen your suggestion and used dispatcher, this time it worked
      > > fine in FF:) But I still have the same js problem, scripts don't get
      > > recognized in IE. in main page I add the tab with dispatcher as
      follows:
      > >
      > > YAHOO.util.Dispatcher.delegate (new YAHOO.widget.Tab({
      > > label: 'Main',
      > > dataSrc: 'InboundMessage.do?method=query',
      > > cacheData: true, /* only load once */
      > > active: true
      > > }), tabView);
      > >
      > > 'InboundMessage.do?method=query' returns a jsp page which includes
      > > basic html buttons and according onclick function definitions in head
      > > of the page in between <script> tags.
      > > What can I do for this IE problem?
      > >
      > >
      > >
      > >
      > > --- In ydn-javascript@yahoogroups.com, Caridy Patiño Mayea
      > > <caridy@> wrote:
      > > >
      > > > Hi again,
      > > >
      > > > That's why you need to use the dispatcher plugin ;-)
      > > >
      > > > Best Regards
      > > > Caridy (caridy at gmail.com)
      > > > http://bubbling.comarq.com/
      > > >
      > > > --- In ydn-javascript@yahoogroups.com, "yaseminavcular"
      > > > <yaseminavcular@> wrote:
      > > > >
      > > > > Hello,
      > > > > I'm loading a tab with a jsp page which includes some js
      functions.
      > > > > function showTab(req){
      > > > > var newTab = new YAHOO.widget.Tab( {cacheData: true,
      > > > > content: req.responseText, active: true});
      > > > > req.response returns something like :
      > > > > <html>
      > > > > <head>
      > > > > <meta http-equiv="Content-Type" content="text/html;
      > > > > charset=ISO-8859-1">
      > > > > <title>Struts Form</title>
      > > > > <script type="text/javascript">
      > > > > alert("inbound")
      > > > > </script>
      > > > > </head>
      > > > >
      > > > > <body>
      > > > > <script type="text/javascript">
      > > > > alert("2")
      > > > > </script>
      > > > > <div id="formdiv">
      > > > > <html:form action="/Person">
      > > > > ......
      > > > > </html:form>
      > > > > </div>
      > > > > <script>
      > > > > alert(4);
      > > > > </script>
      > > > > </body>
      > > > > </html>
      > > > > My page loads fine into tab and evaluates <script> tags -I get the
      > > > > alerts- in firefox. However when I try to run it in IE the page
      > still
      > > > > loads the html part however it doesn't recognize the alerts
      in the
      > > > > code. How can I solve this problem ?
      > > > >
      > > >
      > >
      >
    Your message has been successfully submitted and would be delivered to recipients shortly.