2012-09-17 43 views
2

我有一个控制器:这是什么意思:SCRIPT1006:预期 ')'

public ActionResult Detail(string title, string directory) 
{ 

    ScormModule module = ZincService.ScormService.GetScormModule(title, directory); 


    if (module != null) 
    { 
     ViewBag.TrainingModuleId = module.ScormModuleId; 
     ViewBag.ScormModuleUrl = module.RelativeHtmlPath + '/' + module.EntryPointRef; 
     ViewBag.WindowWidth = module.LaunchWidth; 
     ViewBag.WindowHeight = module.LaunchHeight; 
     ViewBag.title = module.Title; 
     return View(module); 
    } 
    else 
    return RedirectToAction("Index", "Scorm", new { area = "Admin" }); 
} 

然后Detail.aspx文件,其中我调用javascript函数:

<div class="col3"> 
    <a id="training-launch-button" href='javascript:OpenScormModuleWindow("<%: ViewBag.ScormModuleUrl %>", <%: ViewBag.title %>, <%: ViewBag.WindowWidth %>, <%: ViewBag.WindowHeight %>);' class="button">Launch</a> 
</div> 

然后OpenScormModuleWindow:

function OpenScormModuleWindow(trainingModuleUrl, title, width, height) 
{ 
    console.log(trainingModuleUrl); 
    trainingModuleWindow = window.open(trainingModuleUrl, title, "width=" + width + ", height=" + height); 
    trainingModuleWindow.focus(); 
} 

ViewBag.ScormModuleUrl = "/SCORM/SellingWindows/a001index.html"

我从来没有得到的输出console.log(trainingModuleUrl); 当我点击发射按钮时,我得到的错误有问题,它指向一些奇怪的行,是在我的代码中无处?

var _waxArr; var o = document.getElementById('cosymantecbfw'); 
o.addEventListener('waxSetArr', function(evt) { _waxArr = evt.detail; }); 
function waxGetElement(i) { return _waxArr[i]; } 

我搜索了这个代码,但没有找到它

可以有人帮忙吗? 谢谢

回答

3

您的标题是否有空格?

如果是的话,试试这个

<div class="col3"> 
    <a id="training-launch-button" href='javascript:OpenScormModuleWindow("<%:ViewBag.ScormModuleUrl %>", "<%: ViewBag.title %>", <%: ViewBag.WindowWidth %>, <%: ViewBag.WindowHeight %>);' class="button">Launch</a> 
</div> 
+0

是它我加了引号的感谢!现在我得到一个错误:在http:// localhost:11508/Scripts/new.js中第4行第5列未处理的异常 0x80070057 - Microsoft JScript运行时错误:无效参数。 它在线上trainingModuleWindow = window.open(trainingModuleUrl,title,“width =”+ width +“,height =”+ height);谢谢 –

+0

http://www.w3schools.com/js/tryit.asp?filename=try_win_focus –

+1

尝试硬编码你的第一个参数(trainingModuleUrl),可能问题在于它,正如你所说的“我从来没有得到控制台的输出。日志(trainingModuleUrl);当我点击发射按钮“ –

4

注意“co [symantec] bfw”。

我认为这可以追溯到您的浏览器中的诺顿插件。