473,657 Members | 2,678 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Javascript not recognized

I am having issues with a new window that I create in my application
not executing its Javascript. The js is there in the source and looks
all normal, but it is simply not being recognized. I am running on
Jboss 4.0.2. Here is the code, its simple...
<SCRIPT LANGUAGE="JavaS cript">
alert("building image array...");
var image=new Array();
var imageName=new Array();
var name="";
var index=0;
var offset=0;
var isAutoFit=false ;
image[0]="\unassociated \DSC00034.JPG";
imageName[0]="DSC00034.JPG" ;
... (i took this out for brevity's sake, its just populating an
array)
image[29]="\unassociated \SearchVerity";
imageName[29]="SearchVerity" ;

function autoFit(){
var windowWidth;

if ( isAutoFit ) {
if ( document.body.c lientWidth ) {
windowWidth=doc ument.body.clie ntWidth;
}
else if ( window.innerWid th ) {
windowWidth=win dow.innerWidth;
}
document.imageG allery.imagesli der.width=windo wWidth-5;
}
}

function backward(){
if (index > 0){
index--;
}
else {
index=image.len gth-1;
}
document.imageG allery.imagesli der.src=image[index];
document.imageG allery.shortNam e.value=imageNa me[index];
}

function forward(){
alert("wow");
if (index < image.length-1) {
index++;
}
else {
index=0;
}

document.imageG allery.imagesli der.src=image[index];
document.imageG allery.shortNam e.value=imageNa me[index];
}
-->
</SCRIPT>
</HEAD>

<BODY onResize="autoF it()" dir="ltr" bgcolor="#FFFFF F"
style="margin-top:1;margin-bottom:1;margin-left:0;margin-right:0">
<FORM name="imageGall ery" method="post">
<TABLE class="report-table" width="100%" border="0"
cellpadding="0" cellspacing="0" dir="ltr">
<TR>
....
<TD class="button-bar-top">
<INPUT class="button-bar-button" type="button" name="backPb"
value="<<Back" onClick="javasc ript:backward() ;">
<INPUT class="button-bar-button" type="button" name="nextPb"
value="Next>>" onClick="javasc ript:forward(); ">
</TD>
</TR>
</TABLE>
....

thats it...anyone see anything that woulld make it not work? It is in
a window that is opened from a button in the main window, and the html
is dynamically crated using a jsp.

Oct 28 '05 #1
7 2133
VK
> image[0]="\unassociated \DSC00034.JPG";

The first big error (not saying the only one but let's us fix this
first).

document.image[i] is Image object. You cannot assign string value to
it. But it has .src property you can change. Also you have to use HTTP
path notation with "/" as delimiter and "./" as "level-up and from
there down" indication. So the statement has to be either:

image[0].src = "unassociat ed/DSC00034.JPG";
// subdir "unassociat ed" of the current dir

or:

image[0].src = "./unassociated/DSC00034.JPG";
// subdir "unassociat ed" of the parent dir

Please change all statements accordingly through your script. Please
come back if more errors will be found.

Oct 29 '05 #2
That's not the issue. In fact, this entire thing was working when we
were using Tomcat, but it won't work now. The alert at the beginning
of the js wont even fire, nor will the one whenyou press the forward
button. The images are not the issue.

Oct 31 '05 #3
Lee
fi***********@y ahoo.com said:

I am having issues with a new window that I create in my application
not executing its Javascript. The js is there in the source and looks
all normal, but it is simply not being recognized. I am running on
Jboss 4.0.2. Here is the code, its simple...
<SCRIPT LANGUAGE="JavaS cript"> -->
</SCRIPT>
</HEAD>


It doesn't matter how the code is sent to the browser.
All that matters is what arrives at the browser and how the browser
interprets it.

The <script> tag should be:
<script type="text/javascript">

But that shouldn't really cause a problem.

The line:

-->

is a Javascript syntax error. Get rid of it.
Some browsers will ignore it, but you haven't told us which browser
you're testing with.

Oct 31 '05 #4
internet explorer

Oct 31 '05 #5
i actually already got rid of that...didnt help... New update on the
issue as well. This code works just fine deployed on Tomcat... and the
code is identical. So it seems to be a Jboss issue, not a js issue.
Correct me if you think thats wrong

Oct 31 '05 #6
Fixed it. It WAS a jboss issue. File.seperator in the jsp that made
this html/js code was using the backslash instead of forward slash.
Still dont know why, but at least it works now

Oct 31 '05 #7
Lee
fi***********@y ahoo.com said:

i actually already got rid of that...didnt help... New update on the
issue as well. This code works just fine deployed on Tomcat... and the
code is identical. So it seems to be a Jboss issue, not a js issue.
Correct me if you think thats wrong


The difference must be that JBoss is sending different Javascript code
(and/or different HTML). The browser doesn't care where the code comes
from.

Oct 31 '05 #8

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

10
3599
by: Andrea | last post by:
Hi everyone, I am in the process of learning javascript and have a question on location.href. Does javascript always require the <script language = "javascript"> (or script type="text/javascript">) to run? I'm asking because the following chunk of code (drop down menu that goes to different parts of the page) works without declaring anywhere that it's javascript:
12
6533
by: Kevin Lyons | last post by:
Hello, I am trying to get my select options (courses) passed correctly from the following URL: http://www.dslextreme.com/users/kevinlyons/selectBoxes.html I am having difficulty getting the courses to pass the correct option value and then be displayed at the following URL: http://www.dslextreme.com/users/kevinlyons/selectResults.html I am passing countries, products, and courses. The first two display
7
5010
by: KaNos | last post by:
Hello aspx world, I consume a webservice with Javascript functions. But the response is ok and, very strange, document is null. How to resolve this problem thanks ?????? xmlHttpRequest.open("POST", myAddressLocation, false); xmlHttpRequest.setRequestHeader("Content-Type", "text/xml; charset=utf-8"); xmlHttpRequest.send(xmldocumentSoapRequest);
19
2217
by: maya | last post by:
hi, so what is "modern" javascript?? the same as "DOM-scripting"? i.e., editing content (or changing appearance of content) dynamically by massaging javascript objects, html elements, etc? (in conjunction with css, you know, the usual...;) this is what is meant by "modern" javascript?? so how do folks feel about this who think javascript is so evil they disable it from their browsers?? do sites designed with "modern" javascript...
0
8403
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8833
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
8509
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
7345
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5636
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4327
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
2735
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
1967
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
2
1730
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.