Hello All,
I have implemented an Javascript inside an ASP.net page which raises an runtime error. "Object exspected". From wich I don't know what's the problem.
The Javascript is an external script imported into the project. I have put the following code in my codebehind file - Page.RegisterStartupScript("PicitureSwitch", "<script language=javascript src='Images.js'>")
It stops at the following line: - <body bgcolor="#FFFFFF" onload="FP_preloadImgs(/*url*/'images/Product/19154816.jpg', /*url*/'images/Product/19154816.jpg')">
where the FP_preloadimgs is an function in the script.
This is the actual javascript : - <!--
-
function FP_swapImg() {//v1.0
-
var doc=document,args=arguments,elm,n; doc.$imgSwaps=new Array(); for(n=2; n<args.length;
-
n+=2) { elm=FP_getObjectByID(args[n]); if(elm) { doc.$imgSwaps[doc.$imgSwaps.length]=elm;
-
elm.$src=elm.src; elm.src=args[n+1]; } }
-
}
-
-
function FP_preloadImgs() {//v1.0
-
var d=document,a=arguments; if(!d.FP_imgs) d.FP_imgs=new Array();
-
for(var i=0; i<a.length; i++) { d.FP_imgs[i]=new Image; d.FP_imgs[i].src=a[i]; }
-
}
-
-
function FP_getObjectByID(id,o) {//v1.0
-
var c,el,els,f,m,n; if(!o)o=document; if(o.getElementById) el=o.getElementById(id);
-
else if(o.layers) c=o.layers; else if(o.all) el=o.all[id]; if(el) return el;
-
if(o.id==id || o.name==id) return o; if(o.childNodes) c=o.childNodes; if(c)
-
for(n=0; n<c.length; n++) { el=FP_getObjectByID(id,c[n]); if(el) return el; }
-
f=o.forms; if(f) for(n=0; n<f.length; n++) { els=f[n].elements;
-
for(m=0; m<els.length; m++){ el=FP_getObjectByID(id,els[n]); if(el) return el; } }
-
return null;
-
}
-
// -->
Does anyone know what I am doing wrong?
Thank's in advance!!!
2 981 Plater 7,872
Recognized Expert Expert
Well I can tell you that this is wrong:
Page.RegisterSt artupScript("Pi citureSwitch", "<script language=javasc ript src='Images.js' >")
You could just stick this line in your aspx page:
<script language=javasc ript src='Images.js' />
That will include the javascript functions contained in the Images.js file. You can then call them out wherever you would like.
I would bet if you looked at your source code you would see some really funky nested <script lines
Frinavale 9,735
Recognized Expert Moderator Expert
Try using the Page.ClientScri pt.RegisterClie ntScriptInclude () to register your script include instead.
If your ASPX page is Ajax enabled (has a ScriptManager), you should register your script with the ScriptManager instead of the Page or Page.ClientScri pt.
-Frinny
Sign in to post your reply or Sign up for a free account.
Similar topics |
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
|
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...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
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...
| |
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
|
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
|
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
| |