Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Web Programming > JavaScript > BOOK: Beginning JavaScript
|
BOOK: Beginning JavaScript
This is the forum to discuss the Wrox book Beginning JavaScript by Paul Wilton; ISBN: 9780764544057
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning JavaScript section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 13th, 2003, 01:19 AM
Authorized User
 
Join Date: Dec 2003
Posts: 42
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to sasidhar79
Default window.frames("ifrList").location.href

Hello,

I am trying to execute the following asp/javascript code

<%
Dim strPag
strPag=Request.QueryString.Item("page")
Response.write strPag
%>
<html>
<head>
<script language="JavaScript">

/* function selectedTab(blnItemSelect)
{
    document.getElementById("hidValue").value = blnItemSelect;
    document.getElementById("form1").submit();
}*/

var blnFromSearch = false

//var blnListLoaded = true
var blnListLoaded = false
var blnDetailsLoaded = true
var blnUpdateLoaded = true
var blnNewLoaded = true
var blnSearchLoaded = true
var blnfnSelectFromDetails = false
var blnUpdateSelected
var strURL

function selectedTab(tabSelected)
{
    if (tabSelected == 'List')
    {
            document.getElementById("issues_list_nav_level2_li st").className = "nav_level2_selected"
            //strURL = "../issuelist.asp"
            strURL = "../issues/issuelist.asp"
            window.frames("ifrList").location.href = strURL;
    };

    if (tabSelected == 'Details')
    {
            document.getElementById("issues_list_nav_level1_de tails").className = "nav_level2_selected"
            strURL = "issueDetails.asp ";
            window.frames("ifrDetails").location.href = strURL ;
    };

    if (tabSelected == 'New')
    {
            document.getElementById("issues_list_nav_level1_ne w").className = "nav_level2_selected"
            strURL = "issueNew.asp" ;
            window.frames("ifrNew").location.href = strURL;
    };

    /*if (tabSelected == 'Search')
    {
            document.getElementById("issues_list_nav_level1_se arch").className = "nav_level2_selected"
            strURL = "../issueSearch.asp";//?strSessionID="+strSessionID
            window.frames("ifrSearch").location.href = strURL ;
    );*/

}

</script>
<title>YKAP-Issues</title>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<link rel="stylesheet" href="../css/ykap_main.css">
<link rel="stylesheet" href="../css/ykap_individualStyles.css">
</head>
<body class="screen_level1" id="issues_list" >
<form name="form1" action="#" method="post">

    <div class="nav_level2" id="issues_list_nav_level2">
        <a onClick="selectedTab('List')"; href="" class="nav_level2_selected" id="issues_list_nav_level2_list">List</a>
        <a onClick="selectedTab('New')"; href="" class="nav_level2" id="issues_list_nav_level1_new">New</a>
        <a onClick="selectedTab('Details')"; href="" class="nav_level2" id="issues_list_nav_level1_details">Details</a>
        <a onClick="selectedTab('Search')"; href="" class="nav_level2" id="issues_list_nav_level1_search">Search</a>
     </div>



    <div class="content_level1" id="issues_list_content_level1">
        <iframe src="issuelist.asp" id="ifrList" scrolling="no" frameborder="0" style="width:100%;height:550px"></iframe>
    </div>
     <div class="content_level1" id="issues_list_content_level1">
            <iframe src="issuedetails.asp" id="ifrDetails" frameborder="0" scrolling="no" style="width:100%;height:550px"></iframe>
    </div>
    <div class="content_level1" id="issues_list_content_level1">
        <iframe src="isuenew.asp" id="ifrNew" frameborder="0" scrolling="no" style="width:100%;height:550px"></iframe>
    </div>
    <div class="content_level1" id="issues_list_content_level1">
        <iframe src="" id="ifrSearch" frameborder="0" scrolling="no" style="width:100%;height:550px"></iframe>
    </div>
    </form>
</body>
</html>

but the code " window.frames("ifrList").location.href " is not working , ie the page intended is not loading.

i am new to this web programming please let me know hoe to proceeed

thank u
Sasidhar

thanks,
Sasidhar
__________________
thanks,
Sasidhar
 
Old December 13th, 2003, 06:12 AM
Imar's Avatar
Wrox Author
 
Join Date: Jun 2003
Posts: 17,089
Thanks: 80
Thanked 1,576 Times in 1,552 Posts
Default

Hi there,

From what I can see, you have a few problems in your page:
Code:
<a  onClick="selectedTab('List')"; href="" class="nav_level2_selected" id="issues_list_nav_level2_list">List</a>
<a onClick="selectedTab('New')"; href="" class="nav_level2" id="issues_list_nav_level1_new">New</a>
Right now, the page links to "", which will end up as the current folder. To have the onclick fire correctly, instead of the original href, you'll need to link to #. So, this should work:
Code:
<a onClick="selectedTab('List')"; href="#" class="nav_level2_selected" id="issues_list_nav_level2_list">List</a>
<a onClick="selectedTab('New')"; href="#" class="nav_level2" id="issues_list_nav_level1_new">New</a>
Also, change the () for the frames to [], as in:

window.frames["ifrList"].location.href

Internet Explorer will let you get away with using parentheses, but to be cross browser you need the square brackets.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.





Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create 2 Frames in a Single window+Java kotaiah Java Basics 0 August 13th, 2007 10:07 AM
document.location.href surendran Javascript 5 August 3rd, 2005 10:17 PM
window.location crmpicco Javascript 1 July 7th, 2005 08:55 AM
Error Received When Trying to Get Location.Href DragonKing005 Classic ASP Basics 3 May 22nd, 2005 09:54 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.