Re: Can't use Javascript - API from external js file

  •  06-16-2006, 1:33 PM

    Re: Can't use Javascript - API from external js file

    My Code:

    <%@ Page Language="VB" AutoEventWireup="false" CodeFile="Default.aspx.vb" Inherits="_Default" %>

    <%@ Register TagPrefix="CE" Namespace="CuteEditor" Assembly="CuteEditor" %>

    <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">

    <html xmlns="http://www.w3.org/1999/xhtml" >

    <head runat="server">

    <title>Untitled Page</title>

    <script language="javascript" type="text/javascript">

    function Button1_onclick() {

    // get the cute editor instance

    var editor1 = document.getElementById('<%=DescriptionEditor.ClientID%>');

    // Set the editor

    editor1.setHTML('example');

    }

    </script>

    <script language= "javascript" type="text/javascript" src="JScript.js"></script>

    </head>

    <body>

    <form id="form1" runat="server">

    <div>

    <CE:Editor ID="DescriptionEditor" runat="server" ConfigurationPath="~/CuteSoft_Client/CuteEditor/Configuration/mytools.config"

    EnableContextMenuInsert="False"

    EnableContextMenuInsertAdvanced="False" EnableContextMenuInsertFiles="False"

    EnableContextMenuInsertForms="False" EnableContextMenuRelative="False" EnableContextMenuTags="False"

    EnableContextMenuVerbs="False" EnableObjectResizing="False" Height="100px" ShowBottomBar="False"

    ShowCodeViewToolBar="False" ShowDecreaseButton="False" ShowEnlargeButton="False"

    ShowGroupMenuImage="False" ShowHtmlMode="False" ShowPreviewMode="False" Width="240px" ThemeType="Office2003">

    <FrameStyle BackColor="White" BorderColor="#DDDDDD" BorderStyle="Solid" BorderWidth="1px"

    CssClass="CuteEditorFrame" Height="100%" Width="100%" />

    </CE:Editor>

    <input id="Button1" type="button" value="button" language="javascript" onclick="return Button1_onclick()" /></div>

    </form>

    </body>

    </html>
     
    ************************
    like this when the function is in the aspx file every thing work, but if you move the function Button1_onclick() as is to the external JScript.js file, then the function don't work.
     
    thanks,
     
    Moshik
     
     
View Complete Thread