언어 설정

Menu
Sites
Language
gear2: changepage

i am trying to change the current html page with

                 tau.changePage('#settings.html');

not getting any errors, but it does not do anything?

can anyone tell me what I am doing wrong or let me know another way to load a different html page from my js

 

thanks

 

Responses

7 댓글
Slawek Kowalski

You can't change one html document to another one like you do creating web page - probably it is possible,

but it is not what widgets work. Widgets use - let say - AJAX method. You work in scope one page like index.html and change

only some parts of your document.

 

Marco Buettner
Also your selector is wrong.. ('#setting.html') should be ('setting.html')... You use # only for specific ids lile <div id="settings"></div>
AVSukhov

Hello,

Try to use tau.changePage('settings.html');

Stefano Accorsi

Well, I tried to use changePage but it doesn't work. This is my index.html:

    <div id="pageOne" class="ui-page ui-page-active">
    	<header class="ui-header ui-has-more">
			<h2 class="ui-title">Elements:</h2>
			<button type="button" onclick="changePage();"
				class="ui-more ui-icon-overflow">More Options</button>
		</header>
		<div class="ui-content">
			<ul id="localStorageData" class="ui-listview">

			</ul>
		</div>
	</div>
	
	<div id="pageTwo" class="ui-page">
		<header class="ui-header ui-has-more">
			<h2 class="ui-title">Element details:</h2>
			<button type="button" onclick="somethingElse();"
				class="ui-more ui-icon-overflow">More Options</button>
		</header>
	</div>

and this the app.js:

function changePage(e) {
	tau.changePage("pageTwo");
}

Obviously I included tau.js and app.js in the index.html ... but when I run the app and click the button nothing happens.

Well, and if I try to open the tau.js code my IDE crashes!

Andrew Gudz

You forgot about '#'.
tau.changePage("#pageTwo");

Stefano Accorsi

Damn Andrew I love you :D

I read this in SDK help page:

Table: Page changing methods
Method Description
tau.changePage(to) Programmatically change to another page. The to argument is a page object or string.
tau.back() Loads the previous page in the history list.

but there isn't an example ... I could never image I would have to use a leading #. So thank you so much. 

Allan Ang

Hiya

Well you need to use the HTML DOM element as a parameter to the changePage() method.

ie:

tau.changePage(document.getElementById("pageTwo"));