Я пытаюсь создать всплывающее окно в java-скрипте для моего вида сетки, и я не могу открыть окно.Как открыть всплывающее окно к ссылке в gridview
var oldgridcolor;
function SetMouseOver(element) {
oldgridcolor = element.style.backgroundColor;
element.style.backgroundColor = '#ffeb95';
element.style.cursor = 'pointer';
element.style.textDecoration = 'underline';
}
function SetMouseOut(element) {
element.style.backgroundColor = oldgridcolor;
element.style.textDecoration = 'none';
}
function SetMouseDown(element) {
var r = confirm('Are you sure?');
var url = window.location.pathname;
var pathArray = url.split('/');
var host = pathArray[1];
var newHost = '/About.aspx';
if (r == true) {
window.location = host + newHost;
}
else {
alert('it didnt work');
}
return false;
}
код за
protected void gvrecords_RowDataBound(object sender, GridViewRowEventArgs e)
{
if (e.Row.RowType == DataControlRowType.DataRow)
{
e.Row.Attributes["onmouseover"] = "javascript:SetMouseOver(this)";
e.Row.Attributes["onmouseout"] = "javascript:SetMouseOut(this)";
e.Row.Attributes["onmousedown"] = "javascript:SetMouseDown(this)";
}
Любая помощь будет очень высоко ценится.
Внесите window.open вместо window.location window.open ('ваша страница', 'name', 'width = 200, height = 200'); –