clientscript

Why can't you UnRegisterStartupScript?

£可爱£侵袭症+ 提交于 2019-11-28 07:23:11
问题 Seems to me it is a bit wierd that you can do.. Page.ClientScript.RegisterStartupScript(this.GetType(), "KeyName", "alert('changed my mind')", true); And then later on you can't unregister or stop the javascript from being rendered programatically. Why would Microsoft do this? I don't like the work around here.. http://hemant-vikram.blogspot.com/2005/11/unregister-startup-script-workaround.html And I don't like the option of just re-registering it and having it do nothing.. Thoughts? 回答1: I

Yii renderpartial (proccessoutput = true) Avoid Duplicate js request

我怕爱的太早我们不能终老 提交于 2019-11-27 19:32:13
Im creating a site who works with ajaxRequest, when I click a link, it will load using ajaxRequest. When I load for example user/login UserController actionLogin , I renderPartial the view with processOUtput to true so the js needed inside that view will be generated, however if I have clientScriptRegister inside that view with events, how can I avoid to generate the scriptRegistered twice or multiple depending on the ajaxRequest? I have tried Yii::app()->clientScript->isSCriptRegistered('scriptId') to check if the script is already registered but it seems that if you used ajaxRequest, the