• 0

[Javascript] Properties of an Object


Question

Hello Neowin. Yes I am indeed in need of javascript help...again.

I have an array tab objects with the properties .url and .title, what I'm trying to do is to update the properties of each object after a link has been pressed. The tabs .url property controls the URL that is loaded into an iframe and the title is the text on the tab.

var tabcount = 0;
var n = 0;

function changeTab(d) {
	$('#tabs').css({'height':'100%'}).attr('src', tab[d].url);
}

function tabObject(url, title) {
	this.url = url;
	this.title = title;
}

function tabChange() {
	var url = "http://www.yahoo.com";
	tab[n].url = url;                           // n is the array element
	$('#tabs').attr('src', url);               //#tabs is the iframe ID
}

<a href="#" onclick="tabChange()">link</a>

For some reason this isn't updating the iframe.

EDIT

var n comes from this line here :

$('li').click(function(){tabs(this.id)})

Link to comment
Share on other sites

3 answers to this question

Recommended Posts

This topic is now closed to further replies.
  • Recently Browsing   0 members

    • No registered users viewing this page.