HTML滑块导致IE脚本错误

时间:2011-06-09 13:33:35

标签: javascript internet-explorer html5 internet-explorer-9

我有一个简单的HTML5页面,我正在使用滑块来解决一些问题。它们似乎在最新版本的Chrome(13+)和Firefox(4+)中都很好。但是,IE9给了我以下信息:

“Internet Explorer限制此网页运行脚本或ActiveX控件。”

在我点击“允许阻止的内容”之前,滑块现在会显示出来。在我点击允许后,他们工作得很好。

任何想法都是IE出现问题的原因?

以下是该页面的代码:

<!DOCTYPE html>
<html>
<head>
<script src="http://www.frequency-decoder.com/demo/fd-slider/js/fd-slider.js"></script>
<link rel="stylesheet" type="text/css" media="screen, projection" href="http://www.frequency-decoder.com/demo/fd-slider/css/fd-slider.css" />
<link rel="stylesheet" type="text/css" media="screen, projection" href="http://www.frequency-decoder.com/demo/fd-slider/css/demo.css" />
</head>
<body>
<p>
    The following slider has the &#8220;forceValue&#8221; parameter set to TRUE, which
    forces the associated text input to show a valid value.
</p>
<label for="inputTest6" id="inputTest6Label">
    Range: 1 to 5 in steps of 1
</label>
<p>
    <input name="inputTest6" id="inputTest6" type="text" title="Range: 1 to 5 in steps of 1" value="2"  maxlength="6" />
</p>
<script> 
      fdSlider.createSlider({
        // Associate an input
        inp:document.getElementById("inputTest6"),
        // Declare a step
        step:1, 
        // Declare a maxStep
        maxStep:1,
        // Min value
        min:1,
        // Max value
        max:5,
        // Use the "tween to click point" animation
        animation:"tween",
        // Force the associated input to have a valid value
        forceValue:true
        });
      </script>
<p>
    The following slider has been associated with a <code>&lt;select&gt;</code>.
</p>
<label for="selectTest1" id="selectTest1Label">
    Select List with five options
</label>
<p>
    <select name="selectTest1" id="selectTest1">
        <option value="1">One</option>
        <option value="2">Two</option>
        <option value="3">Three</option>
        <option value="4" selected>Four</option>
        <option value="5">Five</option>
    </select>
</p>
<script> 
      fdSlider.createSlider({
        // Associate a select list
        inp:document.getElementById("selectTest1"),
        // Use the tween animation
        animation:"tween",
        // Keep the form element, in this case a select list, visible
        hideInput:false,
        // Give it the className "v-s2" which will make the slider 160px in height
        classNames:"v-s2"
        });
      </script>
</body>
</html>

2 个答案:

答案 0 :(得分:2)

您是否尝试从与该页面相同的域中加载脚本?

答案 1 :(得分:-2)

这样可以解决问题:转到工具 - >网络选项 - >高级选项卡,滚动到安全部分,然后选中“允许活动内容在我的计算机上的文件中运行”。