473,480 Members | 1,845 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Problems with javascript in asp

I have to call a js function from asp. If the last portion which is
the following code is omitted
<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>

from my asp file, then the javascript works fine. But if the above
code is included in my asp page, the javascript code is not executed.
I have to call the js function with in my asp page depending on the
status. Any ideas are appreciated.

This is the code I have:

<% if status = "A" then %>
<SCRIPT language=Javascript src="../MyScripts/test.js"
type=text/javascript></SCRIPT>
<script language="javascript">
var fileurl;
var strrtn;
var outputfile;

strrtn = chop();

</script>
<% elseif status = "B" then %>
<script language="javascript">
alert("B");
</script>
<% End if %>

<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>

Jul 23 '05 #1
2 1519
"NewUser" <rc********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have to call a js function from asp. If the last portion which is
the following code is omitted
<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>

from my asp file, then the javascript works fine. But if the above
code is included in my asp page, the javascript code is not executed.
I have to call the js function with in my asp page depending on the
status. Any ideas are appreciated.

This is the code I have:

<% if status = "A" then %>
<SCRIPT language=Javascript src="../MyScripts/test.js"
type=text/javascript></SCRIPT>
<script language="javascript">
var fileurl;
var strrtn;
var outputfile;

strrtn = chop();

</script>
<% elseif status = "B" then %>
<script language="javascript">
alert("B");
</script>
<% End if %>

<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>


Try removing the word "Call " from "Call objFile.DownloadFile()"?
Jul 23 '05 #2
"NewUser" <rc********@hotmail.com> wrote in message
news:11**********************@f14g2000cwb.googlegr oups.com...
I have to call a js function from asp. If the last portion which is
the following code is omitted
<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>

from my asp file, then the javascript works fine. But if the above
code is included in my asp page, the javascript code is not executed.
I have to call the js function with in my asp page depending on the
status. Any ideas are appreciated.

This is the code I have:

<% if status = "A" then %>
<SCRIPT language=Javascript src="../MyScripts/test.js"
type=text/javascript></SCRIPT>
<script language="javascript">
var fileurl;
var strrtn;
var outputfile;

strrtn = chop();

</script>
<% elseif status = "B" then %>
<script language="javascript">
alert("B");
</script>
<% End if %>

<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>


If I understand correctly, you're wondering why client-side JavaScript
that is being thrown away and never reaches the client when you specify
Call objFile.DownloadFile() isn't executing on the client?

When you do Call objFile.DownloadFile(), the server tosses away all the
previous output and headers, specifies (in this case) Content-Type:
video/x-ms-wmv; and sends the file.

You can't have your cake and eat it too. You can't send Content-Type:
text/html; containing client-side JavaScript, then send Content-Type:
video/x-ms-wmv; from a single GET. What you _could_ do is rely on
client-side JavaScript to execute and then redirect you to the ASP file
containing your DownloadFile() method call:

-- page1.asp

<script type="text/javascript">
alert('Hi there');
location.href = 'pageContainingDownloadFile.asp';
</script>

-- pageContainingDownloadFile.asp

<%

dim objFile
Set objFile = Server.CreateObject("AspSmartUpLoad.SmartUpLoad")
Call objFile.DownloadFile("\\Myserver\filename" , "video/x-ms-wmv",
"myfile")
set objFile = nothing

%>

But this places a dependancy on client-side JavaScript that I would
probably find unacceptable on the public Internet.

--
Grant Wagner <gw*****@agricoreunited.com>
comp.lang.javascript FAQ - http://jibbering.com/faq
Jul 23 '05 #3

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

Similar topics

13
40615
by: Dan R Brown | last post by:
I have a large form that is generated dynamically in a jsp using xml / xslt. So, to break up this form into several "tabbed" sections, I break up the form using <div> tags. Each <div...
3
2207
by: Curious Angel | last post by:
Help? Spec Character Problems w/JAVASCRIPT TOOLTIP Hi, I'm experiencing bizarre problems with quote marks that previously displayed properly in a Javascript TOOLTIP I wrote a year ago . . . and...
0
2352
by: Linda Antonsson | last post by:
Hi, I am trying to put together a CSS-based layout consisting of a header, a sidebar and a main content area. Page: http://www.westeros.org/ASoWS/ CSS:...
3
1714
by: Mark Morton | last post by:
I'm writing an if statement for a UK credit card form validation script. Users who specify that their card is Switch need to enter either the issue number or the 'valid from' date. I'm trying to...
55
4113
by: drhowarddrfine | last post by:
I'm working on a web site that could use some control using js but am concerned about what problems I may have with potential users having their js turned off. Has anyone had any serious problems...
13
3237
by: nick4soup | last post by:
General advice wanted: Some web sites (including two large companies in Australia) get themselves awfully confused if the user presses the BACK button in their browser (and possibly the forward...
2
4052
by: Jeronimo Bertran | last post by:
A couple of questions I am having problems with converting my JavaScript to C#. I have the following code using JavaScript for the mouseover handler that works fine: <SCRIPT...
3
4462
by: PCgeek | last post by:
sorry moved this over to javascript forum, didn't mean to post 2x! Hi guys, I'm trying to put the finishing touches on my website and could really use some help on this particular issue. My page...
11
1564
by: vortex93 | last post by:
hello, i have IE 6 and all the things that need for java in Security Settings are Enable and i still have problems with java like: when i want to open a window that have javascript as link it's...
10
1826
by: jodleren | last post by:
Hi I know, that there are a lot of people having problems with orkut.com, errors like "object expected" and named objects missing. When loading the site can generate some 10 errors, and still...
0
7048
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,...
0
7088
jinu1996
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...
1
6741
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...
0
6956
tracyyun
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...
1
4783
isladogs
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...
0
2986
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
0
1300
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 ...
1
563
muto222
php
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
183
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...

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.