简体   繁体   中英

Accessing javascript from watch window in visual studio?

I'm missing the ability to do 'document.getElementbyId('foo')' and evaluate it or get a list of all the methods etc. when setting a break point in the code behind.

Is this possible to get it from the watch window? (when I type 'document' in the watch window it says:"The name 'document' does not exist in the current context")

如果您只想观看javasript,建议您在firefox中使用FireBug插件,或者在Google Chrome开发人员工具错误(F12)或IE开发人员工具栏中(F12)

After reading Simon Wang's comment, an idea came into my mind:

In the .aspx file I write:

<asp:Literal Text="" ID="activate_debugger" runat="server"></asp:Literal>

In the code-behind, instead of setting a break point, before the line I would usually create a breakpoing I write:

activate_debugger.Text = "<script type='text/javascript'>debugger;</script>";

now I can open the watch window and write document.getElementById('foo');

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM