【发布时间】:2015-05-27 22:24:05
【问题描述】:
我的 Javascript 函数确实有效,但不适用于这段代码。
我显示了所有内容,但导航链接不会针对我的 iframe。
谁能解释我的代码有什么问题?
这是我的代码:
function goto(url) {
document.getElementById("contentFrame").contentWindow.location.replace(url);
}
</script>
<title>SOLSTEN</title>
</head>
<body>
<div id="rubrik"><h1>SOLSTEN</h1></div>
<?php
$mysqli = new mysqli('localhost', 'root', '', 'solsten');
$sql = "select distinct productcategory from products";
$result = $mysqli->query($sql);
echo "<div id='menu'>";
while($myRow = $result->fetch_array())
{
echo "<ul>";
echo "<li style='display: inline;'><a href='javascript:void(0)' onclick='goto('imagegallery.php?category=".$myRow['productcategory']."')'> <h4>".$myRow["productcategory"]."</h4></a> </li>";
echo "</ul>";
}
echo "</div>";
?>
</div>
<div class='content' >
<iframe src="imagegallery.php?category=Armband" scrolling="no" height='100%' width='100%' marginwidth='0' marginheight='0' scrolling='auto' onload='' allowtransparency='false' id="contentFrame"></iframe>"
</div>
我在这张图片上获得了我的导航链接的源代码。 >>http://test.mehmetakb.se/solsten1.jpg
【问题讨论】:
标签: javascript php mysql dynamic navigation