外部文件中的javascript代码

时间:2017-02-11 20:43:54

标签: javascript

当我输入这段代码时,它既可以运行其中一种,也可以两种运行,而不是先运行。

  if (Request.QueryString.HasKeys())
  {
    try 
    {
       //get the id from query string
       string videoID = Request.QueryString["videoID"].ToString();
    }
    catch {  }
 }

2 个答案:

答案 0 :(得分:0)



(function(){
  var topBox = document.getElementById('boxOne');
  topBox.textContent = 'hello!'

  var bottomSection = document.getElementById('bottomSection');
  bottomSection.onmouseover = function() {
    bottomSection.textContent = 'foo';
    bottomSection.style.padding = '';
  };

  bottomSection.onmouseout = function() {
    bottomSection.textContent = 'bar';
    bottomSection.style.padding = '';
  };
}())

<div id="boxOne"></div>
<div id="bottomSection">I am bottom section</div>
&#13;
&#13;
&#13;

似乎有效。不确定什么不适合你。

答案 1 :(得分:0)

您可能想要添加事件侦听器来监听鼠标悬停/鼠标移动操作,如下所示:

Sub Worksheet_Change(ByVal Target As Range)
    Dim macroName As String
    Dim mthsToAdd As Integer
    Dim apd As Date
    macroName = "something"
    If macroName = "PFC" Then
        Application.EnableEvents = False
        mthsToAdd = 3
        'Note: The following formula won't correctly handle cases such as
        '      adding two months to 30 December 2016 (it will calculate
        '      2 March 2017 in that case, due to "30 February 2017" being
        '      treated as "2 days after 28 February 2017")
        Cells(Target.Row, "F").FormulaR1C1 = "=DATEDIF(Today(),DATE(YEAR(RC4),MONTH(RC4)+" & mthsToAdd & ",DAY(RC4)),""d"")"

        'or, if your formula doesn't need to allow for future changes to column D 
        apd = DateAdd("m", mthsToAdd, Cells(Target.Row, "D").Value)
        Cells(Target.Row, "F").FormulaR1C1 = "=DATEDIF(Today(),""" & Format(apd, "mm/dd/yyyy") & """,""d"")"

        'or, if you don't even need to allow for future changes to "Today"
        apd = DateAdd("m", mthsToAdd, Cells(Target.Row, "D").Value)
        Cells(Target.Row, "F").Value = apd - Date()

        Application.EnableEvents = True
    ElseIf macroName = "SPC" Then
        Application.Run Formula2()
    EndIf
End Sub