My biggest question would be: what do you have triggering the javascript? is it supposed to be a button click? A change of a textbox value? A page load? Whatever it is, that object needs to trigger the javascript. Furthermore, I'd suggest putting your javascript in its own file, so you won't have to go change it on every page (especially the pages that don't have a masterpage reference).
1) Make a .js file. It's always easier to access a .js file as long as you're not passing an actual ASP.NET object reference to the .js file (I still haven't figure out a way around that, btw). 2) On your Masterpage, reference your .js file. Example: <script type="text/javascript" src="yourpath/YourJS-File.js"></script>. Follow what Gunawan Hadikusumo mentioned earlier in this post. On any page that doesn't have a masterpage, reference it the same exact way. 3) assign the the .js function to your object, whether it's through the onchange, onblur, onclick, etc. Go here for an example: http://bit.ly/bXg4X0 I hope this explains enough. On Aug 3, 6:40 am, Jeena Ajiesh <jeena...@gmail.com> wrote: > *Thanks for the reply.* > ** > *Actually my script is included in the design page.No particular .js page.* > *I have already done the same counter in the other pages wer im not adding > master page.* > *In the current pahe i adding master page and im not able to get any result. > * > *Any Idea?* > On Tue, Aug 3, 2010 at 1:46 PM, Gunawan Hadikusumo < > > > > > > john.hadikus...@gmail.com> wrote: > > just make sure you set the permission of javascript folder to everyone > > > On Tue, Aug 3, 2010 at 2:41 AM, Jeena Ajiesh <jeena...@gmail.com> wrote: > > >> *Dear Friends,* > >> *I need to use a text counter in an aspx page.* > >> *I wrote the javascript, but the counter s not showing when the program > >> is runed.* > >> *The page has included a master page.* > >> *Where should i include this coding?* > >> *It didnt worked when i placed it in contentplaceholder,** in UpdatePanel > >> and Script Manager.* > >> *Can anyone help?* > >> *Code:* > >> * > > >> < > >> script language="javascript" type="text/javascript"> > > >> function > >> textCounter(field, countfield, maxlimit) { > > >> if > >> (field.value.length > maxlimit) // if too long...trim it! > > >> field.value = field.value.substring(0, maxlimit); > > >> // otherwise, update 'characters left' counter > > >> else > > >> countfield.innerText = maxlimit - field.value.length + > >> " characters remaining"; > > >> } > > >> function > >> doPaste(control) { > > >> maxLength = control.attributes[ > >> "maxLength"].value; > > >> value = control.value; > > >> if > >> (maxLength){ > > >> event > >> .returnValue = false; > > >> maxLength = parseInt(maxLength); > > >> var > >> oTR = control.document.selection.createRange(); > > >> var > >> iInsertLength = maxLength - value.length + oTR.text.length; > > >> var > >> sData = window.clipboardData.getData("Text").substr(0,iInsertLength); > > >> oTR.text = sData; > > >> } > > >> } > > >> </ > >> script>* > >> * * > > >> -- > >> **************** > >> **Thanks & Regards, > >> Jeena Ajiesh > >> Email: jeena....@hotmail.com > >> jeena...@ymail.com* > > > -- > > johnhadikusumo.blogspot.com > >www.miniadverts.com.au > > -- > **************** > **Thanks & Regards, > Jeena Ajiesh > Email: jeena....@hotmail.com > jeena...@ymail.com*