Hiving out java script
HI
On my index.html page I have a load of bloated java script
code from button rollovers.
Am I able to move this to a seperates .js file.
If so what are the drawbacks and how do I do it
Ta
Carlo
Hi,
yes, simply copy/paste the javascript stuff (e.g. functions)
to a new file
(which initially must be blank, that is, an emtpy file without
any predefined e.g. html stuff or so !), which needs to be
"saved as...", say, "myjavascripts.
js" -- when doing so, please note that the original
javascript start/end - tags surrounding your e.g. functions...
<script language="JavaScript" type="text/JavaScript">
<!--
and
//-->
</script>
must NOT be copied/pasted to the external file -- only the
inherent javascript stuff, otherwise you´ll get some
javascript errors !
Your external .js - file needs to be included like this
within the <head>...</head> - part of your document:
<script type="text/javascript"
src="path_to_your_script/myjavascripts.js"></script>
>>
If so what are the drawbacks?
>>
So far I didn´t have any bad experience with
"outsourcing" javascripts.
Similar Messages
-
Data transfer B/W parent windonw and child window with out java script
hi ,
i am using h:outputLink Tag to open child window , i am unable to pass parent window text box value to child window with out java script , Here i am using two different backing beans for parent and child windows . Plz help me .Hi -- I pass details between pages regularly. The following has worked for me:
ApplicationFactory factory = (ApplicationFactory) FactoryFinder.getFactory(FactoryFinder.APPLICATION_FACTORY);
ValueBinding binding = factory.getApplication().createValueBinding("#{beanName}");
BeanName beanProperty = (BeanName) binding.getValue(FacesContext.getCurrentInstance());
... then set the you can set the values. Can't recall if I need to use SaveStates for the items. Probably if you use request scope beans. -
Can I export from Muse cc with out java script coding?
How can I export from Muse CC with out Java Script Coding?
I'm trying to create an custom email but email won't recognize Java Script, Only HTML.
How do I export my tample from Muse CC using only HTML coding?
Thanks in advance.Hello,
It is not possible to selectively export only part of the code for the exported page(s). The pages that are exported, all the code for them is exported, and there's no way to export only the HTML and leave out the rest of it.
Cheers
Parikshit -
my safari screen is greyed out, I checked and found a response to this question. I went to settings and cleared history, cookies, and cache, java script is on and I restarted, screen is still grey, cant touch it to do a thing. Help!
That is usually the fix but try this now.
Reset the iPad by holding down on the sleep and home buttons at the same time for about 10-15 seconds until the Apple logo appears - ignore the red slider - let go of the buttons. See if that helps.
You can also try this - quit Safari. From the home screen - Double tap the home button and your recent apps appear the bottom. Tap and hold down on the Safari icon until it wiggles. Tap the minus sign in the upper left corner to close the app. Tap the home button twice. Restart the iPad.
Message was edited by: Demo -
Hi ...
i have a tabular form
have two columns in that form, kept as a select list by selecting that 1st select list data the related datas has to be popup after selecting that it has to be displayed in the 2nd column by using
java script
eg:
1st column empno-----by selecting the empno the related empname has to be popup
dept no....by selecting the deptno the related deptname has to be popup
thanks in advance,
kishoreThis is a very common question, see
https://forums.oracle.com/thread/2359498 -
Cannot find the menu I had pulled up to edit Java script, please, let me know where it is.
See:
* http://kb.mozillazine.org/Javascript#Enabling_JavaScript -
Adobe Dreamweaver CS5.5 - Windows 7 - Java Script Problem
I am having trouble with Anchor.htm.
When I try to insert an anchor in the text (Insert > Named Anchor> I get this error message:
"While executing insertObject in Anchor.htm a Java Script error occurred."
I recently downloaded both the 32- and 64-bit Java Script applications when I received a message that the existing version of Java Script was out-of-date. Anchor.htm worked before I installed the update.
The files I downloaded and installed are:
jre-7u9-windows-i586.exe
jre-7u9-windows-x64.exe
Please can anyone help me with this problem?From Dreamweaver FAQ
http://forums.adobe.com/thread/429114
"If Dreamweaver is acting erratically, or if you see a message saying "the following JavaScript error(s) occurred", it's usually a sign of a corrupt cache file. The first thing to try should always be to delete the file cache. If that doesn't work, delete your personal Configuration folder. Full instructions are in Deleting a corrupted cache file.
http://forums.adobe.com/thread/494811"
Nancy O. -
Dreamweaver 8: Java script in Design Mode
Mac OS 10.4.11 Dreamweaver 8
I have a web page with a java script that displays a random picture from a list of images each time you reload the page.
http://www.irises.org
It renders fine when viewed in a browser, but the image does not display when viewed in Dreamweaver Design mode. The random image does not display and lacking the image other things are out of place.
The script that sets up the image array:
<!-- Begin
// Set up the image files to be used.
var theImages = new Array() // do not change this
// To add more image files, continue with the
// pattern below, adding to the array.
theImages[0] = 'images/home-rotate-1.jpg'
theImages[1] = 'images/home-rotate-2.jpg'
theImages[2] = 'images/home-rotate-3.jpg'
theImages[3] = 'images/home-rotate-4.jpg'
theImages[4] = 'images/home-rotate-5.jpg'
theImages[5] = 'images/home-rotate-6.jpg'
theImages[6] = 'images/home-rotate-7.jpg'
theImages[7] = 'images/home-rotate-8.jpg'
theImages[8] = 'images/home-rotate-9.jpg'
theImages[9] = 'images/home-rotate-10.jpg'
theImages[10] = 'images/home-rotate-11.jpg'
theImages[11] = 'images/home-rotate-12.jpg'
theImages[12] = 'images/home-rotate-13.jpg'
theImages[13] = 'images/home-rotate-14.jpg'
theImages[14] = 'images/home-rotate-15.jpg'
theImages[15] = 'images/home-rotate-16.jpg'
theImages[16] = 'images/home-rotate-17.jpg'
// do not edit anything below this line
var j = 0
var p = theImages.length;
var preBuffer = new Array()
for (i = 0; i < p; i++){
preBuffer[i] = new Image()
preBuffer[i].src = theImages[i]
var whichImage = Math.round(Math.random()*(p-1));
function showImage(){
document.write('<img src="'+theImages[whichImage]+'">');
// End -->
The code (further down the page after the all the list elements) that generates the image:
<SCRIPT LANGUAGE="JavaScript">
<!-- This script and many more are available free online at -->
<!-- The JavaScript Source!! http://javascript.internet.com -->
<!-- Begin
showImage();
// End -->
</script>
Is there a way to get it to display correctly in the Design mode?
Thanks
<br />
</script>Is there a way to get it to display correctly in the Design mode?
I don't think so, at least not with this script. What you need is for an image to be displayed on the page by default, and for the javascript to only change the src attribute's value. Something like this -
At the point where you want the image have -
<img src="the_path_to_some_default_image.jpg" id="rotation" />
and in the javascript, change this -
document.write('<img src="'+theImages[whichImage]+'">');
to this -
document.getElementById('rotation').src='theImages[whichImage]';
See if that works.... -
Hp photosmart premium wireless C309 can't print after updating to IE 9 and i think java script
hp photosmart premium wireless C309 can't print after updating to IE 9 and i think java script. I am a realtor working from home and inorder to use the forms it required I update to IE9 and I think java, this is the link. http://www.car.org/tools/zipform6/ After doing so my printer does not work. I tried to go on line and reinstall from a link on line but it did not work. I don't know what to delete and what to add and how to get the " HP sSolution center" to work again. the printer was already poor performance from day one. Always having to unplug and restart and the black ink always runs out too quick. but right now my concern is just being able to print and scan. I am in the middle of a deal and can not communicate with all parties effectively. please help
What error messages are you getting?
What OS are you using?
How is the printer connected to the computer?
-------------How do I give Kudos? | How do I mark a post as Solved? -------------------------------------------------------- -
How can I link to pages in a 2 level popup index/selection tree with java script?
I can do a single level popup index using the java script below (#1) and link the selections to pages but to change to a 2 level popup index selection tree as below (#2) I can't seem to figure out how to link to pages. Any help greatly appreciated. Thanks
1
var itemIndex = app.popUpMenu("INTRODUCTION", "ALPHABET", "GRAMMAR", "NUMBERS", "DATES & TIME", "GETTING TO KNOW PEOPLE", "PHRASES FOR LEARNING", "DIRECTIONS & TRANSPORTATION", "DESCRIBING THE TRAIL", "DO'S & DON'TS", "EQUIPMENT", "FOOD", "INTRODUCING A VILLAGE", "CULTURE AND ETHNIC GROUPS", "HANDICRAFTS", "TEMPLES & MONKS", "AGRICULTURE", "ANIMAL HUSBANDRY", "SCHOOL & EDUCATION", "LEADING A TREK", "NATIONAL PROTECTED AREAS", "IDENTIFYING WILDLIFE", "PLANTS & FORESTS", "BOATS", "CAVES", "HEALTH AND SAFETY")
switch (itemIndex) {
case "INTRODUCTION":
this.pageNum = 1
break
case "ALPHABET":
this.pageNum = 2
break
case "GRAMMAR":
this.pageNum = 5
break
case "NUMBERS":
this.pageNum = 30
break
case "DATES & TIME":
this.pageNum = 35
break
case "GETTING TO KNOW PEOPLE":
this.pageNum = 42
break
case "PHRASES FOR LEARNING":
this.pageNum = 56
break
case "DIRECTIONS & TRANSPORTATION":
this.pageNum = 59
break
case "DESCRIBING THE TRAIL":
this.pageNum = 63
break
case "DO'S & DON'TS":
this.pageNum = 68
break
case "EQUIPMENT":
this.pageNum = 74
break
case "FOOD":
this.pageNum = 83
break
case "INTRODUCING A VILLAGE":
this.pageNum = 96
break
case "CULTURE AND ETHNIC GROUPS":
this.pageNum = 105
break
case "HANDICRAFTS":
this.pageNum = 120
break
case "TEMPLES & MONKS":
this.pageNum = 126
break
case "AGRICULTURE":
this.pageNum = 131
break
case "ANIMAL HUSBANDRY":
this.pageNum = 140
break
case "SCHOOL & EDUCATION":
this.pageNum = 145
break
case "LEADING A TREK":
this.pageNum = 151
break
case "NATIONAL PROTECTED AREAS":
this.pageNum = 155
break
case "IDENTIFYING WILDLIFE":
this.pageNum = 161
break
case "PLANTS & FORESTS":
this.pageNum = 169
break
case "BOATS":
this.pageNum = 175
break
case "CAVES":
this.pageNum = 178
break
case "HEALTH AND SAFETY":
this.pageNum = 182
break
2
var aINTRODUCTION = ["INTRODUCTION", "How to Use This Book", "Format"];
var aALPHABET = ["ALPHABET", "Vowel Sounds", "Consonant Sounds"];
var itemIndex = app.popUpMenu(aINTRODUCTION, aALPHABET);
Thanks.Thanks. I've got it now. I was mistakenly renaming itemIndex to each section...Introduction, Alphabet
-
How to create a class using java script..
Hi all,
Iam new to java script and I tried out the following program but its not working..I basically created a class just like a java prog' but Iam not getting any output or error.Iam attaching the code below.
If I created one function inside the script and create one object its working fine but what should I do when I have a lot of function??so I created a class and put all the function and created an object but its not working..
Do let me know what changes should I do..Iam attaching the code which I had written. or give me an example of how to create a class with couple of functions using JAVASCRIPT
Thanks
Avis_su
<html>
<head><title>JSP Page</title></head>
<body>
<SCRIPT language = "JavaScript">
<!--
//Created classes
class book
var title: String;
var author:String;
function author()
doucument.write("Author is " +this.author);
function tile()
doucument.write("Title is " +this.title);
function printall()
var counter = 0;
function author();
function title();
var chapters = Array[String];
for(chapter in this chapters)
counter++;
document.write("Chapter" counter" :"+this.chapters[chapter]+"<br>");
var thisbook = new book()
thisbook.author = "Sivagami";
thisbook.title = "MS in CS giude";
thisbook.chapters = new Array[10];
thisbook[0] = "Prepare to Excell in all ";
thisbook[1] = "Learn to be happy";
thisbook[2] = "Learn to be healthy mentally emotionally physically";
thisbook[3] = "Siva and Subbu along with kidssssss will be successful in future";
thisbook.printall();
//-->
</script>
</body>
</html>Run this program to get your answer:
public class AnswerToYourPost {
public static void main(String args[]) {
System.out.println("TRUE/FALSE: This question
ion belongs on a Java forum.\n"
+ "ANSWER: " + ("Javascript" == "Java"));
}Since when do we compare objects for equality using operator == ? -
How to Debug Java Script in Adobe Form
I have used an alert for empty fields . I have used Check button control for this.
But the button click is very inconsistent. Some times it triggers the event sometimes it doesnt. Is there anyway to debug the java script. I have installed Script editor for IE but I am unable to use it for Adobe Forms.
Any help is appreciated.
Thanks,
VasuHi Vasu,
i think that maybe is the check sequence is not very correct.. and maybe you can try to code it one check for empty fields at a time..
example
Name.
Address.
Tel.
Hp.
Email.
so u can try to code for one item at a time then slow try to debug it... as last time i use to insert the javascript inside each component then after it i implement into a button and slowly check for the check sequence which one need to be 1st and etc.
hope it help you. if not maybe u can give more information. maybe i can help you out at myside.
Regard,
Ng Jia Jun -
Page failure when attempting to save java script in html header
Currently there is java script code for a function that is seeded in the html header of a forms page by apex when the form is generated. This code is for the chicken test for the DELETE button.
The function works as designed, but if I try to "APPLY CHANGES" to the the page definition I get the The page cannot be displayed "Cannot find server or DNS Error". "the url is http://nldg-3.appl.devjones.com:7777/pls/apex/wwv_flow.accept" If I remove the script coding from the HTML header the page will save just fine, but of course no more java script.
I need to add a java script function to the page and I am unable to do so at this time because of this issue. I can reproduce this error on any of the sample apps that I have loaded into apex.
the Apache error log contains:
[Fri Feb 13 06:11:06 2009] [error] [client 172.16.85.122] [ecid: 1234527066:192.168.211.127:31922:0:17188,0] mod_plsql: /pls/apex/wwv_flow.accept HTTP-500 Error Reading Data from Client!!
The Apache access gets:
172.16.85.122 - APEX_PUBLIC_USER [13/Feb/2009:06:23:47 -0600] "POST /pls/apex/wwv_flow.accept HTTP/1.1" 500 653
Apex is version 3.1.2.00.02 and uses on iAS on a Linux server. The Database is 10g. The browser is IE 6.0.2900.2180.
I have been developing for about 3 months in Apex and this is the first issue of this kind that I have run into. Any help will be greatly appreciated as I have no clue at this time.Luis,
All the forms are created by Apex with a default function in the html header for a delete chicken test as follows:
<scrpt language="JavaScript" type="text/javascript">
<!--
htmldb_delete_message='"DELETE_CONFIRM_MSG"';
//-->
Even though the function is already a part of the page, if I try to save it, it will fail. I will look into the "black list" a little deeper. I have asked around abit as I also had suspected that, but so far all the answers were that it should not be a problem. If I take out the "SCRIPT" word I can get the page to save, but of course the code is worthless at that point.
Keith -
How to populate a java script array from a bean.
Hi all,
I have a list "mdfProductNames" which is further comprising of two fields "subGroup" and "mdfProductName"
The list is coming is a part of the form bean.(struts framework)
Now i want to have the values of these two fields in two different java script arrays.
i.e. Array x -> mdfProductName
and Array y -> subGroup
can someone give me any idea as to how to do this ?
Thanks
Edited by: Ramit on 17 Jul, 2008 9:53 AMhi,
assuming u use jstl, u need to create javascript variable during html generation out of the values got from struts form bean. it could look like this:
------ .jsp file ----
<%@ taglib uri="http://java.sun.com/jstl/core" prefix="c" %>
<script type="text/javascript">
var X = [];
var Y = [];
<c:forEach items="${formBeanName.mdfProductNames}" var="grpProdName">
X.push( '${grpProdName.mdfProductName}' );
Y.push( '${grpProdName.subGroup}' );
</c:forEach>
// here u already have the two arrays filled up with data
</script>
------- end of .jsp file
"formBeanName" is a name of a formbean u use to store the list of your beans
rafal baton zaczynski
http://baton.pop.e-wro.pl - tips and codes
http://www.belysio.com - free mobile localization soft -
Sreaming at the top of my lungs for HELP with Java Script problem!
Hello,
I have this strange problem that no one seems to know why or how to fix it.Whenever I encounter a web site that has java scripting for anything pop ups or redirects to url's anything that says java script when I mouse over the link my browsers do nothing.That is for explorer 6.0 beta netscape 4.7 and netscape version 6.I have tried in another forum some suggestions but nothing changed even though I am told nothing is wrong with the java scripting.I used to be able to click java script's with all of these browsers but no longer.That was a few months ago.Now to try something new I tried to see if a new browser would work.I now have the latest version of Opera.It did work but using Opera on some sites limits what I can do so it doesn't solve my problem.Then I tried the Sun JavaHot browser it also worked but limits what I can do on some site's.I have Windows 98 & updated most of my dll's etc & my java is version 2 1.3.1.My java script is enabled in Explorer & netscape's & the security is at a minimum level.Please help me figure out why these other browsers work but the other's do not.I want to edit a web site of mine but I can't because of this problem.I am very frustrated by this and need as detailed help as I can get.Anything of a suggestion would be very much appreciated.But I am also not an expert on the working's of a computer so bear with me.
BrianHi,
Well I am thinking that if anyone could know something about Java script it would be java developers.But anyways I had the previous version of explorer 5.0 & the java didn't work in it either.Now how weird is this,I opened netscape 4.7 today & the java scripts are suddenly working.This has me scratching my head wondering if my computer is possesed by some force beyond my capability to know...????Weird as it seems though the explorer still will not respond to a java script.
Brian
Maybe you are looking for
-
Key fields in tables ce31000 and ce41000
In transaction KE11 ( change sales and profit plan ), tables CE31000 and CE41000 are used. I have to read those tables in a report but I cannot find the relevant keys to find unique records. There are some fields I know, but using those fields I get
-
Issue in Report output I am facing strange issue. I have created a BEx query and Executed in Bex analyser. In this output I can able to see * mark as values instead of KF. Anyone can help me in this.
-
PSCS4 11.0.1 (OS 10.5.6) crash with Raw files
Throughout the day, I will open a Raw image in the Raw dialog box and CS4 will crash (see report below). Sometimes it will crash right when I quit CS4. Every few days it will crash for no apparent reason. Very annoying. Any suggestions? I only open o
-
Erorr calling long running sync web service
Hello I have definied simple async process: assign (from process input to ws invoke input) sync ws invoke assign (from ws invoke output to process output) Sync Web Service is long running (few minutes). In order to avoid timeout I have accordingly se
-
Quality Notifications tasks authorization
Hello Experts, Need your advice on Quality Notification authorization access. In Quality Notifications once a coordinator enters the tasks we want to control who can have access to delete a task or change the user responsible for tasks. In other word