2011-01-12 88 views
0

我有面包屑導航標籤:if else聲明 - 基於iFrame內容?

<li>Eligibility</li> 

請記住,我是很新的學習.NET。

在此頁面上有iFrame的內容,在那裏你點擊一個鏈接可查看相應內容:

<ul id="ss-categories" > 
    <li class="eligibility"> 
    <a href="#" onclick="ChangeFrame('mem_eligibility.aspx');")>Eligibility</a href> 
    </li> 
    <li class="deductible"> 
    <a href="#" onclick="ChangeFrame('mem_deductible.aspx');")>Deductible</a href> 
    </li> 
    <li class="claims"><a href="#" onclick="ChangeFrame('mem_claims.aspx');")>Claims &amp; EOBs</a href> 
    </li> 
    <li class="benefits"> 
    <a href="#" onclick="ChangeFrame('mem_benefits.aspx');")>Benefits</a href> 
    </li> 
    <li class="hospital"> 
    <a href="#" onclick="ChangeFrame('mem_priorAuth.aspx');")>Hospital Admissions</a href> 
    </li> 
    <li class="priorauth"> 
    <a href="#" onclick="ChangeFrame('mem_Inpatient.aspx');")>Prior Authorizations</a href> 
    </li> 

和iframe,顯示基於鏈接的內容,你點擊:

<iframe id="ctl00_middleContent_frame1" style="float:left" scrolling="auto" frameborder="0" height="400" width="100%" src="mem_eligibility.aspx"> 

在該導航斷點的頂部,如何我是否會編碼它,以便它會根據iFrame中顯示的內容部分進行更改。

即(在方面,雷曼兄弟)

if iFrame src="mem_elibigility.aspx" { 

document.write = 'Eligibility' 
} 

if iFrame src="mem_deductible.asps" { 
document.write = 'Deductible' 
} 

希望是有道理的,是的,我知道我的代碼是完整的垃圾......而且不規整的權利,但在那一刻,那不是我的工作.. 。

回答

0

更新版本:

下存儲了控制自己的iFrame作爲標題屬性,它使用jQuery來設置你的「頭」區域的標題的URL。我試圖收拾了一下代碼的爲好,但這個應該工作,你需要的東西:

的jQuery(例):

$(document).ready(function(){ 

    $('#ss-categories li').click(function() 
           { 
            var test = $(this).text(); 
            $("#title").text(test); 
            //Code to change iframe based on property of the item clicked goes here 
            var title = $(this).attr("title"); 
            $('#ctl00_middleContent_frame1').attr('src', title); 
           }); 
}); 

HTML(例):

<ul id="ss-categories" > 
    <li class="eligibility" title="mem_eligibility.aspx"> 
    <a href="#">Eligibility</a> 
    </li> 
    <li class="deductible" title="mem_deductible.aspx"> 
    <a href="#">Deductible</a> 
    </li> 
    <li class="claims" title="mem_claims.aspx"> 
     <a href="#">Claims &amp; EOBs</a> 
    </li> 
    <li class="benefits" title="mem_benefits.aspx"> 
    <a href="#">Benefits</a> 
    </li> 
    <li class="hospital" title="mem_priorAuth.aspx"> 
    <a href="#">Hospital Admissions</a> 
    </li> 
    <li class="priorauth" title="mem_Inpatient.aspx"> 
    <a href="#">Prior Authorizations</a> 
    </li> 


    <li id="title" style="font-size: x-large; font-weight: bold">Eligibility</li> 
<iframe id="ctl00_middleContent_frame1" style="float:left" scrolling="auto" frameborder="0" height="400" width="100%" src="http://www.google.com"> 

試試這個演示,看看是否是你想要的功能:Updated Demo

較舊的回答:

就是這樣的demo你在找什麼?

代碼:

$(document).ready(function(){ 

    $('#ss-categories li').click(function() 
           { 
            var test = $(this).text(); 
            $("#title").text(test); 
            //Insert logic here to change iFrame based on clicked item 
           }); 
}); 

它創建一個能夠吸引在列表中的環節之一的「名」的功能,它會顯示在您的「標題」區域。如果我正確地理解了你 - 我認爲這會做你需要的。