Including a javascript using the javascript file

Come play with particular models of javascript in my CF code when I stumbled on this issue.

I have two files with that I'm testing.  The javascript file that I want to include is called KDL.js.  The contents are listed here:

<script language="javascript">
  function KDL_Test(MyString) {
  var MsgString = MyString + "KDL Rocks";
  alert(MsgString);
  }
</script>

The other model is called KDL.cfm, and it's content:

<CFINCLUDE TEMPLATE="kdl.js"> 

<script language="javascript">
  KDL_Test("I am here. ");
</script>

It works fine I get my alert window whenever I run the code.

What I don't understand is why the javascript alert window is not get called when I use javascript to include the javascript model?

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

<script language="javascript">
  KDL_Test("I am here. ");
</script>

This code generates error messages, but I don't get the popup either as I did with the first include.  Thoughts?

language = "JavaScript" has been deprecated for years and should not be used.  It has been replaced by type = "text/javascrpt", you already have.  And as long as the .js file in the same folder as the .cfm file, it should work.

I have never seen anyone CFINCLUDE a .js file, before, so I'm puzzled.  It shouldn't really work, because how JavaScript is a language on the client, and CF is a server side.  But, if it works, I can't argue (although my brain rush to the idea of working).

Another thing: any content JavaScript code in a .js file must not tags.  It is assumed script since it is inside a file with a .js extension.

Load the .cfm file in a browser with the developer (F12) tools.  If you use FireFox with the FireBug plugin, you should see a great deal of information as to why it does not work.

HTH,

^_^

Tags: ColdFusion

Similar Questions

  • Build dimension using the rules file

    I use Oracle Hyperion worm 9.3.1. So that the dimensions of formatting built using the rule file, I came across the 'JOIN' and 'Create Join using' options. Can someone help me to know the difference between these two options?

    Published by: 873675 on July 20, 2011 12:25 AM

    The documentation explains the difference with examples, now I was going to post the link, but I might as well post the info from the link.

    Join the fields

    You can join several fields into one. The new field is given the name of the first field in the join. For example, if a data source has separate fields for the number of product (100) and the family of products (-10), you must join the fields (100-10) before loading in the Sample.Basic database.

    Create a field by joining fields

    You can reach the fields by placing fields joined in a new field. This procedure leaves intact original fields. Creating a field is useful if you need concatenate the fields of the data source to create a member.

    For example, if a data source has separate fields for the number of product (100) and the family of products (-10), you must join the fields (100-10) before loading in the Sample.Basic database. If, however, you want to keep the two existing fields in the data source, you can create a field (100-10) using a join. The data source includes now all three fields (100, - 10 and 100-10).

    To read other rule options - http://download.oracle.com/docs/cd/E17236_01/epm.1112/esb_dbag/ddlfield.html

    See you soon

    John
    http://John-Goodwin.blogspot.com/

  • How to upgrade a driver automatically in Windows NT by using the batch file

    I use the devcon tool to update a Windows XP driver, but unfortunately it does not support Windows NT. So I'm looking for a similar tool for Windows NT. Does anyone know any tool / or script that would update a driver via file/command line in Windows NT?

    Thank you for taking the time to read the question.

    Hello supportalcon,

    Thank you for the question!

    It is disheartening to know that have problems you with the Windows Driver. As I understand it, you need to update a driver automatically in Windows NT by using the batch file.

    The question you posted would be better suited in the MSDN Forums. I would recommend posting your query in the MSDN Forums. You can follow the link to your question:

    http://social.msdn.Microsoft.com/forums/en-us/categories/

    Meet us if you face any problem of Windows, and I'd be happy to help you again and try to correct the problem as soon as possible.

    Good day!

    Hope this information helps.

  • Why not be able to run MRT.exe using the batch file?

    When I run the following script using the batch file, MRT cannot be run.

    Does anyone have any suggestions?

    Thanks in advance for your suggestions

    off @echo
    C:\WINDOWS\system32\Mrt.exe/q/f

    Hello

    ·         The computer is connected to a domain network?

    ·         What is the error you get when trying to execute the batch file?

    If the computer is connected to a domain network, I suggest you to report this issue in Windows XP IT Pro Forums: http://social.technet.microsoft.com/Forums/en-US/category/windowsxpitpro

    Thank you.

  • How to adjust the volume to specific levels by using the batch file?

    I use Windows Media player and want to adjust the volume level automatically using planning.

    Anyone have any suggestions on how to set the volume level by using the batch file?

    such that 0 is mute and 10 max, I want to set the volume 4

    Thanks in advance for your suggestions

    Eric

    Hi Eric,.

    The question you have posted is better suited to the MSDN forums. You can ask your question in the help link.

    http://social.msdn.Microsoft.com/forums/en-us/categories

    Hope the helps of information.

  • Cannot read the CD after you have used the active file system

    I use the active file system in Vista to save my work on CD - R. I have often refer to these discs, and occasionally add other files. Once the disk is full, I start a new.

    After referencing files on a disc, I pushed the button as usual. The disc was not immediately ejected. A window on the toolbar open and told me to wait and finally ejected the disc.  When I tried to use the disc again, I could not access the data. I know that the data is still on the disk. In 'Computer' I see '327 MB 702 MB free space'.

    If I click on the drive or try to open it, I get a message "no answer." Finally, I get a window that says to "drag files to the disc to add data. Vista think it as a blank disc.

    Is it possible to access data on the disk, so I can save up to a new drive? Also, what hurts which has caused this problem? I don't want to do it again.

    Thank you!
    Bob

    Hello

    Check the drive in another computer, better check in several. CD and DVD door, especially
    RW. If the question with a single disc? There are companies that may be able to recover the
    data if it is quite expensive.

    Very good idea to have redundant backups.

    I hope this helps.

    Rob Brown - Microsoft MVP<- profile="" -="" windows="" expert="" -="" consumer="" :="" bicycle="" -="" mark="" twain="" said="" it="">

  • How to convert dvd win7 with the ISO on my office installation files so that I can again use the iso file to make an installation key bootable win for my net book which has no dvd player.

    I bought a proffessional win7 genuine dvd of microsoft I received today. the dvd has no iso file but only installation files. I need to install win 7 on my dell inspiron mini 1018 10 net accounting that only has usb ports and no dvd support. So I want to use a microsoft tool (if it is possible to avoid 3rd party tools) and firstly convert the files in the bootable dvd into an iso file on my desktop which has the dvd player. so I want to use the iso file and use the windows download dvd tool from microsoft to make a bootable USB key and use it to install win 7 on my netbook usb ports. I need urgent links to the microsoft tool if it is available or any reliable free tool to convert DVDs to iso. Help, please

    You can use iSO recorder:

    ISO Recorder v3

  • Is there anyway that I can use the MP3 files for the computer system sounds in windows 7

    Is there anyway that I can use the MP3 files for the computer system sounds in windows 7. Any help would be appreciated, thanks - Joe

    I don't think so. If you convert the .wav files, you could. Google for an MP3 to WAV converter.
     
     
  • How to use the xmp file

    I'm retouching of images of a customer and he suggested that I use the xmp file.  Can someone help me understand how to use it in Photoshop or Lightroom (or bridge).  I understand that the xmp files can contain metadata.  They also contain edit changes customers want as brightenes value, white temp, color etc.?

    Thank you very much

    Lisa

    This is the menu that appears when you open a raw file in Photoshop?

    Yes, this is the Camera Raw plugin.

    The XMP file contains the changes that have been made so far in the file, but cannot contain suggestions for future changes.

    You don't have to do anything to associate the XMP file to the image, except by checking that the two files are in the same folder.

    Camera Raw will automatically read the changes.

  • Use for a PS file browser now? I'm used to use the browser file on CS1

    Use for a PS file browser now? I'm used to use the browser file on CS1

    New versions of Photoshop comes with Adobe Bridge to organize image files.  However you are not required to use it.  You can also use LightRoom or system utility such as Windows File Explorer and the Mac Finder.  Photoshop itself uses system dialog boxes to access your files from file systems.   When Photoshop displays a beautiful or save dialog for you in all likelihood, it is a Windows or Mac system dialog box.  Versions of Photoshop can also have some internal dialogues of programmed by Adobe Photoshop to access your systems file systems.

  • To use the raw files of fujifilm xt-1 with cs5

    I want to improve my for CS5 raw converter, so I can use the raw files of Fujifilm XT-1. When I try to download camera raw 6_4_1 it will not install. I use OS 10.8.5.

    Can someone tell me what I am doing wrong.

    Given that this device requires at least camera raw 8.4 and photoshop cs5 can only use raw 6.7 camera upward for the plugin, you can use the

    Adobe 8.6 dng converter to convert you X - T1 files Fuji camera raw dng best, should open so that photoshop cs5.

    Camera Raw plugin | Supported devices

    Applications of camera Raw compatible Adobe

    8.6 Adobe dng Converter:

    Adobe - Adobe Camera Raw and DNG Converter: for Macintosh: Adobe DNG Converter 8.6

    How to use the dng Converter:

    Camera Raw: How to use Adobe DNG Converter - YouTube

    In photoshop cs5, you can check what version of camera raw, you have by going to Photoshop > about plug-in and clicking on the words of Camera Raw.

    If you need the raw update 6.7 camera:

    Adobe - Adobe Camera Raw and DNG Converter: for Macintosh: Camera Raw 6.7 update

  • How oracle 10.2.0.5 Patch using the response file

    Hello

    OS linux
    Oracle 10g DB

    my project team plans for oracle 10.2.0.5 PSU upgrade on top of oracle 10.2.0.4 on Linux platform.
    can someone share how to make PSU installation using the .rsp file...

    Thank you
    Sam.

    Comment of those who, like like below in the .rsp file and try it.

    #MYORACLESUPPORT_USERNAME
    #MYORACLESUPPORT_PASSWORD

    . / runInstaller-silent - responsefile /ora/Disk1/response/patchset.rsp DECLINE_SECURITY_UPDATES = TRUE

  • Models of DW: 'this document uses the following files not in this site.

    I recently started using DW templates in CS6. It was a bit frustrating at first, but seems well wouth it. I've created quite a few pages in the folder root of hares and have no problems there. However, I created a new folder to a different section of my site (mysite.com/new_folder/new_page.htm), and then went to save a new page of the model and got the message "this document uses the following files not in this site. Its the same site, just a new folder which is placed at the root.  When I save the page in the new folder there to make a copy of duplicant images, css scripts and place them in the new folder to work? Must be a way to do it and have DW know where to find the original files surely?

    Thank you

    I downloaded a test page... It turns out that the 'message' was just misleading and all the Info page has correct links. Everything is good

  • Photoshop CS4 - is - does anyone know how to find out if two people use the same file?

    Photoshop CS4 - is - does anyone know how to find out if two people use the same file?

    Yes, I assumed that was the case, and I thought that this link addressed to her.  I would have thought it was more a function of your network and the OS than Photoshop.

  • recover the database unitl cancel using the control file

    I refreshed with db1 db2, copied all the newspapers dbfile and archive to the db2 server and setup/adjusted spfile, controlfile etc on the new db2 server and has
    recover the database unitl cancel using the control file.
    ALTER database open resetlogs.

    Now the customer want to refresh it after 2 days, I wonder of I need only archive newspapers or both? to do the same again?

    Published by: DBA2008 on November 11, 2009 09:49

    Yes, you can 'restore to cancel' several times.

  • Center aligning images in table using the XML file

    Hello
    I use a flash file that uses an xml file to download a series of images one by one in a photo-gate.
    There are two different widths of images. The height is always the same. Is it possible to set up so that each image that calls file xml is center aligned as part of image.
    At the present time when using the xml file to load the image she always left aligns the image when he brings it in image even if you change the alignment to center align in the Panel align.
    Does anyone have a suggestion why this happens or how to fix it?
    Thanks for the help

    I did this quickly and did not test - but if it does not directly at the exit it might give you a starting point - or someone else can correct if there are errors. I'll check tomorrow - where I am its time to go to sleep...
    CHANGE the DETAILS: Just changed a few pieces of code I posted last night - I forgot to change the statement holder_mc.loadMovie in xml.onLoad Manager. I have not tested, but its along the lines of the approach I would use to solve your problem with resizing the image. Let me know how you go with it.

Maybe you are looking for

  • Belt nylon with hook in gold?

    Can we ever expect some accessories to match the watch aluminum gold? I see that there are nylon with a metal buckle straps but that comes with the watch, but apparently not for stand-alone resale. Is this good? Why? Show little love for those of us

  • which regarded as blasphemous

    I interviewed a person who used the phrase "poop in the pool. She used two or three times. I'm going to describe this episode as "explicit"? I can try editing, but it will be a pain. Thank you.

  • His number disappointed + B500 USB device not recognized at startup

    Hello We have 2 B500 whenever I'm starting, after loading windows they give me an error "USB device not recognized" I don't know what to do any help will be greatly appreciated as it is strange that both machines are giving the same error. also on on

  • Why I can't access this channel name?

    Hi all I'm pragmatic about this VI creating a task and add a channel.  I then get the channels, the first string of the index and tries to open it.  LabVIEW says it's an invalid string!  If I create the task in MAX, indexing the channel and reading h

  • Simultaneous inputs from different sources

    I am creating a resistively heated wire heating unit.  What I had planned to do, is to connect the wire to a programmable DC power supply that I would link to a USB-232 (Jack single port RS232).  I also want to integrate some temperature readings of