Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Web Programming > JavaScript > Javascript
Password Reminder
| FAQ | Members List | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Thread Tools Search this Thread Display Modes
  #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';
     document.all[commId].style.display = 'none';
     document.all[imageId].src = '../Images/collapse.gif';

Best Regards,
Best Regards,
Reply With Quote

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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

All times are GMT -4. The time now is 02:07 PM.

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