小编Bre*_*red的帖子

为什么jQuery自动降低套管属性值?

我正在使用直接放入HTML文件的SVG

<svg>
   Contents...
</svg>
Run Code Online (Sandbox Code Playgroud)

使用javascript/jQuery我想向SVG添加一个属性

$("svg").attr("viewBox", "0 0 166 361");
Run Code Online (Sandbox Code Playgroud)

以下是运行上述脚本后修改的SVG

<svg viewbox="0 0 166 361">
   Contents...
</svg>
Run Code Online (Sandbox Code Playgroud)

注意它放置viewbox而不是viewBox.由于viewbox(小写)没有做任何事我需要它是viewBox(camelcase)

有任何想法吗?

**更新**

我运行了一个小测试,我从服务器端渲染了viewBox属性,然后我运行了上面的脚本.你可以看到1.从服务器端渲染时,它很好.2. jQuery没有识别camelCase viewBox属性,并在所有小写字母中插入了另一个.

<svg version="1.1" id="Layer_1" x="0pt" y="0pt" width="332" 
     height="722" viewBox=" 0 0 100 100" viewbox="0 0 166 332">
...
</svg>
Run Code Online (Sandbox Code Playgroud)

jquery

24
推荐指数
1
解决办法
6260
查看次数

使用Google Calendar Feed的DotNetOpenAuth

我试图通过使用DotNetOpenAuth从Google获取日历列表几天来绞尽脑汁.

我可以使用DotNetOpenAuth示例成功获取联系人列表.我已使用OpenId + OAuth将其与我的域集成.一切都很好,以获得联系人列表.

所以我从那里修改了代码以尝试检索日历列表,并且我一直收到401 Unauthorized错误.

我知道这是授权,因为我可以获得联系人列表.有没有人有一个代码示例如何使用Google的DotNetOpenAuth检索日历或日历事件?

谢谢

更新:

谢谢你的回复.我已经阅读了所有可以得到的东西.这是我到目前为止所做的

第1步:我在GoogleConsumer.cs中创建了一个新的GetCalendarEndPoint

private static readonly MessageReceivingEndpoint GetCalendarEndpoint = new MessageReceivingEndpoint("https://www.google.com/calendar/feeds/default", HttpDeliveryMethods.GetRequest);
Run Code Online (Sandbox Code Playgroud)

第2步:接下来,我在GoogleConsumer.cs中的GetContacts方法之后创建了一个新方法GetCalendars - (重建了dll等)

    public static XDocument GetCalendars(ConsumerBase consumer, string accessToken, int maxResults/* = 25*/, int startIndex/* = 1*/) {
            if (consumer == null)
            {
                throw new ArgumentNullException("consumer");
            }

            var request = consumer.PrepareAuthorizedRequest(GetCalendarEndpoint, accessToken);
            var response = consumer.Channel.WebRequestHandler.GetResponse(request);
            string body = response.GetResponseReader().ReadToEnd();
            XDocument result = XDocument.Parse(body);
            return result;
Run Code Online (Sandbox Code Playgroud)

第3步:在我的应用程序中,我将ScopeURI从GoogleConsumer修改为Calendar URI,如下所示

private IAuthenticationRequest GetGoogleRequest()
{
    Realm realm = Request.Url.Scheme + Uri.SchemeDelimiter + …
Run Code Online (Sandbox Code Playgroud)

c# asp.net oauth google-calendar-api dotnetopenauth

6
推荐指数
1
解决办法
1478
查看次数

MVC2中的Ajax.BeginForm错误?用于发布错误控制器的Ajax?

我正在使用ajax表单尝试使用Create方法回发CustomerController.这是代码

<% using (Ajax.BeginForm("Create", "Customer", new AjaxOptions { LoadingElementId = "saving"}, new { @class = "block_content form" }))
        {%>...
Run Code Online (Sandbox Code Playgroud)

当我的html表单呈现时,表单看起来像这样

<form onsubmit="Sys.Mvc.AsyncForm.handleSubmit(this, new Sys.UI.DomEvent(event), { insertionMode: Sys.Mvc.InsertionMode.replace, loadingElementId: 'saving', onComplete: Function.createDelegate(this, $j('#accoutcreate').dialog('close')) });" onclick="Sys.Mvc.AsyncForm.handleClick(this, new Sys.UI.DomEvent(event));" method="post" class="block_content form" action="/Job/Create?Length=3"> ...
Run Code Online (Sandbox Code Playgroud)

正如您所看到的,表单实际上是发布到/ Job/Create而不是/ Customer/Create

我不确定为什么会这样.有任何想法吗?

c# asp.net-mvc asp.net-mvc-2

1
推荐指数
1
解决办法
1132
查看次数