window.parent.document.getElementById("category2").src=""用法

zzcat1 2005-12-05 06:19:22
有达人告诉我,如何在这个src里写含有数据库查询的地址吗?
该src是定义在qsiframe.asp中的一个JS函数里的一个参数,该JS函数的作用是当鼠标移到id为category1框架里的数据的时候,在id为category2的框架里显示出qsiframe_qno.asp的内容.category1和category2两个子框架位于同一个父页面.qsiframe_qno.asp里定义有数据库查询.如果我直接在src里写"qsiframe_qno.asp",当鼠标移动到category1框架的数据的时候,category2子框架显示为空白,我应该要如何写这个地址才能把qsiframe_qno.asp页面在category2框架里显示出来呢?
qsiframe_qno的数据库显示没问题.
...全文
1060 7 打赏 收藏 转发到动态 举报
写回复
用AI写文章
7 条回复
切换为时间正序
请发表友善的回复…
发表回复
wangganbu 2005-12-08
  • 打赏
  • 举报
回复
继续顶到前面去...
zzcat1 2005-12-08
  • 打赏
  • 举报
回复
可能问题没描述好,让大家不知道怎么处理,我再写一遍:

父页面products.asp中有两个iframe子框架id分别为:category1和category2.

在两个子框架中要显示的页面分别是:qsiframe.asp和qsiframe_qno.asp

qsiframe.asp的功能是:显示产品大类
qsiframe_qno.asp的功能是:显示产品大类下的产品

我现在要实现通过Javascript函数将这两个iframe关联起来,当鼠标移动到category1子框架里产品大类条目的时候,category2里显示相应的产品.

因此我在qsiframe.asp里定义了一个JS函数cbar,该函数中有个参数是地址.当我将地址参数写为window.parent.document.getElementById("category2").src="qsiframe_qno.asp?pid=14&pmid=12"时可以在category2中显示出满足pid为14和pmid为12的产品来.但我应当如何写地址才能让onmouseover事件调用cbar函数的时候让鼠标在category1上不同数据移动的时候在category2中显示出相应的产品来?

我写window.parent.document.getElementById("category2").src="qsiframe_qno.asp?pid=<% &rs("pid")%>&pmid=<% &rs("pmid")%>"系统提示出错.应该如何写?

求高手指点一二!感激不尽!

有人建议我用XML,但XML我一点都不熟,估计是弄不出来的.

有人回复如下:

1.在客户的数据
window.parent.document.getElementById("category2").src="qsiframe_qno.asp?pid=14&pmid=12

2.服务端的数据
window.parent.document.getElementById("category2").src="qsiframe_qno.asp?pid=<% &rs("pid")%>&pmid=<% &rs("pmid")%

在客户端不能采用上述2的方法,可以采用如tagID.value,或this.value的方法

他说的东西是不是能做到?该如何做?
zzcat1 2005-12-07
  • 打赏
  • 举报
回复
兔子以及风之石,昨天没看帖,不过,今天试了你们的方法,还是都不行啊!
好郁闷,继续顶~~`
zzcat1 2005-12-07
  • 打赏
  • 举报
回复
有人可一解决吗?
是不是很困难啊...
dh20156 2005-12-05
  • 打赏
  • 举报
回复
TRY:
parent.category2.location = "???.htm";
  • 打赏
  • 举报
回复
你要通过form么??form的target指向另外一个frame页就好了
wangganbu 2005-12-05
  • 打赏
  • 举报
回复
顶一下,大家帮我!
eclipse-testng 离线包 document href="{testng:absolutePath('style.css')}" format="text"> .testMethodStatusCONF { } .testMethodStatusCONF { display: none; } .testMethodStatusFAIL { background-color: #FFBBBB; } .testMethodStatusFAIL { background-color: #FFBBBB; display: none; } .testMethodStatusPASS { background-color: lightgreen; } .testMethodStatusPASS { background-color: lightgreen; display: none; } .testMethodStatusSKIP { background-color: #FFFFBB; } .testMethodStatusSKIP { background-color: #FFFFBB; display: none; } cal-align: top; } .suiteStatusPass, .suiteStatusFail { padding-right: 20px; width: 20px; height: 20px; margin: 2px 4px 2px 2px; display: inline; } .suiteStatusPass { background-color: green; } .suiteStatusFail { background-color: red; } .testCaseLink, .testCaseLinkSelected { margin-top: 2px; padding: 4px; cursor: pointer; } .testCaseLink { background-color: #f6f6f6; } .testCaseLinkSelected { background-color: lightblue; border: 1px solid gray; padding: 3px; } .testCaseFail, .testCasePass, .testCaseSkip { padding-right: 15px; width: 15px; height: 15px; margin: 2px 4px 2px 2px; display: inline; } .testCaseFail { background-color: red; } .testCasePass { background-color: green; } .testCaseSkip { background-color: yellow; } tr.methodsTableHeader { background-color: #eaf0f7; font-weight: bold; } tr.methodsTableHeader td { padding: 3px; } .testMethodStatusFAIL a, .testMethodStatusPASS a, .testMethodStatusSKIP a { color:navy; text-decoration: none; cursor: pointer; } .testMethodStatusFAIL td, .testMethodStatusPASS td, .testMethodStatusSKIP td { padding: 3px; } .testMethodDetails, .testMethodDetailsVisible { padding: 5px; background-color: #f5f5f5; margin: 1px; } .testMethodDetails { display: none; } .testMethodsTable { margin-top: 10px; font-size: 12px; } .testMethodsTable td { border-width: 1px 0 0 1px; border-color: white; border-style:solid; } .testMethodsTable .testMethodStatusCONF td.firstMethodCell { border-left: 5px solid gray; } ]]> document> document href="{testng:absolutePath('main.js')}" format="text"> CaseLink; function clearAllSelections() { if (selectedTestCaseLink != null) { selectedTestCaseLink.className = "testCaseLink"; } } function selectTestCaseLink(testCaseLinkElement) { clearAllSelections(); testCaseLinkElement.className = "testCaseLinkSelected"; selectedTestCaseLink = testCaseLinkElement; } function switchTestMethodsView(checkbox) { document.getElementById ("testMethodsByStatus").style["display"] = checkbox.checked ? "none" : "block"; document.getElementById ("testMethodsByClass").style["display"] = checkbox.checked ? "block" : "none"; } function toggleVisibility(elementId) { var displayElement = document.getElementById(elementId); if (getCurrentStyle(displayElement, "display") == "none") { displayElement.style["display"] = "block"; } else { displayElement.style["display"] = "none"; } } function toggleDetailsVisibility(elementId) { var displayElement = document.getElementById(elementId); if (displayElement.className == "testMethodDetails") { displayElement.className = "testMethodDetailsVisible"; } else { displayElement.className = "testMethodDetails"; } } function getCurrentStyle(elem, prop) { if (elem.currentStyle) { var ar = prop.match(/\w[^-]*/g); var s = ar[0]; for(var i = 1; i < ar.length; ++i) { s += ar[i].replace(/\w/, ar[i].charAt(0).toUpperCase()); } return elem.currentStyle[s]; } else if (document.defaultView.getComputedStyle) { return document.defaultView.getComputedStyle(elem, null).getPropertyValue(prop); } } function testMethodsFilterChanged(filterCheckBox, status) { var filterAll = document.getElementById ("methodsFilter_ALL"); var filterFail = document.getElementById("methodsFilter_FAIL"); var filterPass = document.getElementById("methodsFilter_PASS"); var filterSkip = document.getElementById ("methodsFilter_SKIP"); var filterConf = document.getElementById("methodsFilter_CONF"); if (filterCheckBox != filterAll) { filterMethods(filterCheckBox, status); checkMainFilter(filterAll, filterFail, filterPass, filterSkip, filterConf); } else { filterFail.checked = filterPass.checked = filterSkip.checked = filterConf.checked = filterAll.checked; filterMethods(filterAll, "FAIL"); filterMethods(filterAll, "PASS"); filterMethods (filterAll, "SKIP"); filterMethods(filterAll, "CONF"); } closeAllExpandedDetails(); } function checkMainFilter(filterAll, filterFail, filterPass, filterSkip, filterConf) { if ((filterFail.checked == filterPass.checked) && (filterPass.checked == filterSkip.checked) && (filterSkip.checked == filterConf.checked)) { filterAll.checked = filterFail.checked; } else { filterAll.checked = false; } } function filterMethods (filterCheckBox, status) { var visible = filterCheckBox.checked; alterCssElement ("testMethodStatus" + status, "display", visible ? "" : "none"); } function alterCssElement(cssClass, element, value) { var rules; if (document.all) { rules = 'rules'; } else if (document.getElementById) { rules = 'cssRules'; } for (var i = 0; i < document.styleSheets.length; i++) { for (var j = 0; j < document.styleSheets [i][rules].length; j++) { if (document.styleSheets[i][rules][j].selectorText.indexOf(cssClass) > -1) { document.styleSheets[i][rules][j].style[element] = value; break; } } } } function closeAllExpandedDetails() { var node = document.getElementsByTagName("body")[0]; //var re = new RegExp("\ \btestMethodDetailsVisible\\b"); var els = document.getElementsByTagName("div"); for (var i = 0,j = els.length; i < j; i++) { if (els[i].className == "testMethodDetailsVisible") { els[i].className = "testMethodDetails"; } } } function renderSvgEmbedTag(chartWidth, chartHeight) { var success = false; var userAgent = navigator.userAgent; if (userAgent.indexOf("Firefox") > -1 || userAgent.indexOf("Safari") > -1) { success = true; } else if (navigator.mimeTypes != null && navigator.mimeTypes.length > 0) { if (navigator.mimeTypes["image/svg+xml"] != null) { success = true; } } else if (window.ActiveXObject) { try { testObj = new ActiveXObject("Adobe.SVGCtl"); success = true; } catch (e) {} } var chartContainer = document.getElementById('chart-container'); if (success) { var chart = document.createElement('embed'); chart.src = 'overview-chart.svg'; chart.type = 'image/svg+xml'; chart.width = chartWidth; chart.height = chartHeight; chartContainer.appendChild(chart); } else { var message = document.createElement('h4'); var text = document.createTextNode('SVG Pie Charts are not available. Please install a SVG viewer for your browser.'); message.style.color = 'navy'; message.appendChild(text); chartContainer.appendChild(message); } } ]]> document> <xsl:value- of select="testng:getVariableSafe($testNgXslt.reportTitle, 'TestNG Results')"/> <script type="text/javascript" src="main.js"/> d h m s  ms
:
:
    -
call-template name="writeCssFile"/> call-template name="writeJsFile"/> call-template name="htmlHead"/> src="navigation.html"/> src="overview.html"/> call-template name="navigationFile"> call-template> document href="{testng:absolutePath('overview- chart.svg')}" format="xml"> Failed () Passed () Skipped () document> document href="{testng:absolutePath('overview.html')}" format="xhtml"> call-template name="htmlHead"/>

Test suites overview

<script type="text/javascript"> renderSvgEmbedTag(, );
call-template name="percentageOverview"> call-template>

call- template name="powered-by"/>
document> document href="{testng:absolutePath('reporterOutput.html')}" format="xhtml"> call-template name="htmlHead"/>

Reporter output

call-template name="powered-by"/>
document>
document href="{testng:absolutePath('navigation.html')}" format="xhtml"> call-template name="htmlHead"/>

/ / /
call-template name="suiteContentFile"> call-template> call-template name="suiteGroupsFile"> call-template> call-template name="suiteTestCasesLinks"> call-template> call-template name="suiteTestCasesContentFiles"> call-template>
document> document href="{testng:absolutePath(testng:suiteContentFileName($suiteElement))}" format="xhtml"> call-template name="htmlHead"/> call-template name="percentageOverview"> call-template>
All methods in suite
call-template name="testMethods"> call-template> call-template name="powered-by"/>
document>
document href="{testng:absolutePath(testng:suiteGroupsFileName($suiteElement))}" format="xhtml"> call-template name="htmlHead"/>

Groups for suite:

call-template name="powered-by"/>
document>


call-template name="testMethodsList"> call-template> call-template name="testMethodsList"> call-template> call-template name="testMethodsList"> call-template>
Name Started Duration Exception
call-template name="testMethodsList"> call-template>

Name Started Duration Exception

 
call-template name="formField"> call-template> call-template name="formField"> call-template> call-template name="formField"> call-template> call-template name="formField"> call- template> call-template name="formField"> call-template> call- template name="formField"> call-template> call-template name="formField"> call-template> call-template name="formField"> call-template> call-template name="formFieldList"> call-template> call-template name="formFieldList"> call-template>
                                        
                                    
                                        
                                    
<No stacktrace information>
document href="{testng:absolutePath (testng:testCaseContentFileName(.))}" format="xhtml"> call-template name="htmlHead"/> call-template name="percentageOverview"> call-template>
Test case
call-template name="testMethods"> call-template> call-template name="powered-by"/>
document>
Generated with TestNG XSLT

28,391

社区成员

发帖
与我相关
我的任务
社区描述
ASP即Active Server Pages,是Microsoft公司开发的服务器端脚本环境。
社区管理员
  • ASP
  • 无·法
加入社区
  • 近7日
  • 近30日
  • 至今
社区公告
暂无公告

试试用AI创作助手写篇文章吧