Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations dencom on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

DHTML image float works, but not in Visual Studio project 1

Status
Not open for further replies.

nwruiz

Programmer
Jun 22, 2005
60
US
Hello,

This thread is an extension of thread855-1085351 in the ASP.NET forum. Please read it to familiarize yourself with the issue. As a brief summary, I have created some DHTML code that makes an image float from off the top of the screen to a location on the page. Five seconds later, it fades and becomes invisible. The code I have posted works, if you want to see the sample.

My problem is that I am trying to take this barebones code and place it within my company's Visual Studio project, using ASP.NET. However, when I try to paste over the code and debug the webpage, I get a JavaScript error, stating:
'document.getElementById(...).filters.alpha' is null or not an object.

For some reason, the identical code is not working correctly in ASP.NET. I was hoping that someone could help troubleshoot this issue with me, as I am unsure of why such a discrepancy would occur. Thanks for your time.

Nick Ruiz
CO-OP Intern, PPL Electric Utilities
Webmaster, DealMerchant.net
 

I am unsure exactly what you mean with your description of it not working "inside your visual studio project"... but I'm going to assume this is not important and assume that you are using this as some kind of IDE and that the target code is for a web browser.

The following thoughts would only make sense with those assumptions:

You may be running the javascript before the page has loaded (so a call to getElementById may be failing because the object doesn't exist (yet)).

It may be that the id has a typo (just a long-shot here).

The whole filter thing isn't going to work across all browser/platforms. Just so you know.

Just some thoughts,
Jeff

 
To better describe what I meant, the Visual Studio project contains all of the web services and apps that are used on the company's corporate website. I am integrating my barebones example into the project.

While this might be slightly outside of this forum, I invoke the JavaScript function within the Page_Load subroutine of the .aspx.vb file. With respect to the browser compatibility, I use a different method to change the opacity of the image in Firefox/Netscape.

I think that the fact that I'm using Visual Studio w/ ASP.NET is important, since the JavaScript is the same in both my barebones example and the project itself.

Nick Ruiz
CO-OP Intern, PPL Electric Utilities
Webmaster, DealMerchant.net
 
I have resolved the problem. What happened was the JavaScript function was not available, since it was being processed and trying to access an object that was not yet created on the page. To get around this, I made my JavaScript code a separate entity that does not require ASP.NET to invoke it.

Nick Ruiz
CO-OP Intern, PPL Electric Utilities
Webmaster, DealMerchant.net
 

self said:
You may be running the javascript before the page has loaded
[smile]
Not exactly what I predicted... but as close as I could ever get (having never use the .net environment). I'm glad it all worked out for you -- and thanks for following up with the solution for those others that will pass this way.

Cheers,
Jeff
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top