Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
| Search | Today's Posts | Mark Forums Read
Javascript General Javascript discussions.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Javascript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old June 14th, 2006, 01:57 AM
Authorized User
 
Join Date: Nov 2005
Location: mumbai, maharashtra, India.
Posts: 48
Thanks: 0
Thanked 0 Times in 0 Posts
Default Javascript Works Fine in Aspx page but...

Hello Everyone,

I am using Javascript which is called on click of image from c# code...
this script works fine in aspx page but i use this same code in ascx.cs custom control this script fails to detect an object such as div and image...this is the script....when i compared the view source of both aspx page and custom control. The Script in page was in head section and postback script was found. Where in Custom Control view source the javascript was in body section and no post back script was found.... Any Help or Idea will be appreciated

<SCRIPT language="javascript">

 function Toggle( commId, imageId )
  {

    var div = this.document.getElementById(commId);
    var GetImg = this.document.getElementById(imageId);
     alert (commId+" and "+imageId)
displays corresponding value
    alert (div+" and "+GetImg)
fails to display detects object and displays null
    if (document.all[commId].style.display == 'none')
    {
     document.all[commId].style.display = 'block';
     document.all[imageId].src = '../Images/expand.gif';
    }
    else
    {
     document.all[commId].style.display = 'none';
     document.all[imageId].src = '../Images/collapse.gif';
    }
    }
</SCRIPT>




Best Regards,
Vivek.
__________________
Best Regards,
Vivek.


Similar Threads
Thread Thread Starter Forum Replies Last Post
import to simplexml works fine, but cannot output jjk2 Beginning PHP 0 March 22nd, 2008 08:36 PM
zxml.js exception in Firefox but works fine in IE lgarc BOOK: Professional Ajax ISBN: 978-0-471-77778-6 6 January 29th, 2007 05:25 AM
Javscript works well in aspx page but fails... vivek_inos ASP.NET 1.0 and 1.1 Professional 2 June 18th, 2006 11:26 PM
Appletviewer can't find class...but IE works fine dperry BOOK: Beginning Java 2, JDK 5 Edition 0 July 7th, 2005 10:44 AM
Works fine on web server, not on dev machine eoffshore PHP How-To 1 July 9th, 2003 09:32 AM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.