Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Error while loading ".JS" using DHTML

    Hi all,
    I have a situation here, that is I am creating a dynamic HTML page with text area in it. I have included a ".JS" file in that HTML. Now the problem is when I click a button which triggers this popup(The DHTML), IE hangs. This can be resolved when i change the IE settings "Check for newer version of this page" to "Never". But the issue is i cant ask the all users to do this. Is there any way to handle this issue in the script itself. Hope you guys understood my issue.

    Thanks
    M

  • #2
    Regular Coder martin_narg's Avatar
    Join Date
    Jul 2002
    Location
    Chamonix, France
    Posts
    600
    Thanks
    1
    Thanked 3 Times in 3 Posts
    Off the bat, it doesn't sound like a problem specific to caching (http://en.wikipedia.org/wiki/Caching ). However caching issues can be alleviated by forcing no-caching of the page using meta tags.
    Code:
    <META HTTP-EQUIV="CACHE-CONTROL" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="PRAGMA" CONTENT="NO-CACHE">
    <META HTTP-EQUIV="EXPIRES" CONTENT="0">
    Caching headers can also be used effectively if the page is being generated using a server-side language such as PHP/ASP - although it sounds like you are using a static HTML page with JavaScript included.

    To be able to see what might be the problem more easily it would help if you could please post up the html code and js include file.

    m_n
    "Cos it's strange isn't it. You stand in the middle of a library and go 'Aaaaaaaaaaaaaaaaggggggghhhhhhh!'
    and everybody just stares at you. But you do the same in an aeroplane, and everybody joins in."
    -Tommy Cooper

  • #3
    New to the CF scene
    Join Date
    Jul 2005
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts
    Hi,
    Thanks for the reply. My point is that when clicking button this function fEnterComment is called. Here a dynamic page is generated which includes a ".JS" file, this file the browser doesnt fetch from the cache instead goes to the server to find and then hangs out there.

    I have tried the meta tag stuff, but in vain.

    This is related to ITS where ABAP is the server side script. The code that makes the browser hangs is give below

    //*********************Code begin***********************//
    function fEnterComment(ptitle,varid,varidf,endjs,pTop,pLeft,initScreen)
    {
    //Set window properties
    var initval = document.perfrev.item(varid).value;
    var myWProp1 = 'directories=no,location=no,menubar=no,status=no,titlebar=no,toolbar=no,dependent=yes';
    var myWProp2 = ',scrollbars=yes,top=' + pTop + ',left=' + pLeft + ',width=700,height=250,resizeable=no';
    var myWProp = myWProp1 + myWProp2;
    var newWin = open(src="", 'myDoc', myWProp);
    if (arguments.length == 4) newWin.moveTo(120,300);
    var jso = '<script language=javascript>';
    var jse = endjs;

    //Variable to hold JS function to validate before Save and Continue
    var jsc1 = 'var vTitle="' + ptitle + '";';
    jsc1 += 'function fContinue() {';
    jsc1 += 'if (document.enttext.tcf.value=="X"){';
    jsc1 += 'editor.EditorGetHTMLText();';
    jsc1 += 'self.opener.document.perfrev.' + varidf + '.value="X";';
    jsc1 += 'self.opener.document.perfrev.' + varid + '.value=document.enttext.IDT.value;';
    // jsc1 += 'alert(self.opener.document.perfrev.' + varid + '.value);';
    jsc1 += 'self.opener.document.perfrev.elements[0].value = "SAVT";';
    jsc1 += 'self.opener.document.perfrev.submit();}';
    jsc1 += 'vTitle=" ";';
    jsc1 += 'window.moveTo(10000,10000);';
    jsc1 += 'window.blur();}';
    // jsc1 += 'window.close();}';
    jsc1 += 'function CheckToBlur() {';
    jsc1 += 'if (self.opener.window.closed == true){';
    jsc1 += 'window.close();}';
    jsc1 += 'if (vTitle==" "){';
    jsc1 += 'window.blur();}}';
    jsc1 += 'function fCancel() {';
    jsc1 += 'vTitle=" ";';
    jsc1 += 'window.moveTo(10000,10000);';
    jsc1 += 'window.blur();}';

    //Variable to hold JS function to validate maximum length of text entry
    var jsl1 = 'function validateTextLength(obj,maxLength){';
    jsl1 += 'document.enttext.tcf.value="X";';
    jsl1 += 'self.opener.document.perfrev.' + varidf + '.value="X";';
    jsl1 += 'if(obj.value.length >= maxLength) {';
    jsl1 += 'alert("Maximum length of the text is " + maxLength + " characters");';
    jsl1 += 'obj.value = obj.value.substring(0,maxLength-1);}';
    jsl1 +='return true;}';


    newWin.document.writeln('<html>');
    newWin.document.writeln('<head>');
    newWin.document.writeln('<title>Enter Comment:' + ptitle + '</title>');
    newWin.document.writeln('<' + 'script language=JavaScript src="`mimeURL(~service="zh110",~theme="99",~language="en",~name="ScripLib.js")`"' + '>');
    newWin.document.writeln('<' + '/script' + '>');
    newWin.document.writeln(jso);
    newWin.document.writeln(jsc1);
    newWin.document.writeln(jsl1);

    newWin.document.writeln(jse);
    newWin.document.writeln('</head>');
    newWin.document.writeln('<body onFocus="CheckToBlur()">');

    //Create Body page
    newWin.document.writeln('<form name=enttext method="post">');
    newWin.document.writeln('<input type=hidden name="tcf" value="">');
    newWin.document.writeln('<table width=350><tr><td>');
    newWin.document.writeln('Comments');

    // Begin of Remedy ATS01681094 E000457
    // newWin.document.writeln('<div style="position:relative;top=0px;left=0px;height:160" width=100%>');
    newWin.document.writeln('<div style="top=0px;left=0px;height:160" width=100%>');
    // Begin of ATS01681094 E000457

    newWin.document.writeln('<TEXTAREA id=IDT name="textc" ROWS="10" COLS="80" style="visibility:hidden;position:absolute;top:0px;left:0px">');
    //onKeyDown="validateTextLength(this,1000)" onKeyUp="validateTextLength(this,1000)" >');
    newWin.document.writeln(initval);
    newWin.document.writeln('</TEXTAREA>');
    newWin.document.writeln('<' + 'script' + '>');
    newWin.document.writeln('var mimeURL="`mimeURL(~service="zh110", ~theme="99", ~language="en", ~name="")`" + "/";');
    newWin.document.writeln('var initialHTML=document.enttext.IDT.value;');
    newWin.document.writeln('var elTextarea = document.enttext.IDT;');
    newWin.document.writeln('var elChange = document.enttext.tcf;');
    newWin.document.writeln('var editorHeight = "140";');
    newWin.document.writeln('var idGenerator = new IDGenerator(1);');
    newWin.document.writeln('var editor = new Editor(idGenerator);');
    newWin.document.writeln('editor.Instantiate();');
    newWin.document.writeln('<' + '/script' + '>');
    newWin.document.writeln('<' + '/div' + '>');
    newWin.document.writeln('</td></tr></table>');
    newWin.document.writeln('<img id=CBT src="`mimeUrl(~theme="99", ~language="en", ~name="save_and_continue.gif")`" alt="Close Detail" onclick="return fContinue()">')
    newWin.document.writeln('<img id=CBT src="`mimeUrl(~theme="99", ~language="en", ~name="cancel.gif")`" alt="Cancel" onclick="return fCancel()">')
    newWin.document.writeln('</form>');
    newWin.document.writeln('</body>');
    newWin.document.writeln('</html>');

    //Close the stream to the document
    newWin.document.close();
    if (initScreen=='X') {
    newWin.blur();
    } else {
    newWin.focus();
    }
    }
    //***********************Code End*********************//

    One more thing. This code above works fine if the
    "Internet options"--> "setting"-->Check for newer version of stored page" is set to "never"

    Thanks
    M


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •