How to display the content on same page?
hello,
I want to display the content on same web page dynamicly. but I can't find the way. the model likes:
_______________
| |
| display area |
|______________|
Submit
Every time when I click the button [Submit], the content will reflesh. but all these will only take place on client. Not running on the server. we know it is easy on PC just like:
................................................................
function Compute()
{
var string;
string="<table><tr><td>"+Math.random()+"</td></tr></table>";
document.getElementById("display").innerHTML=string;
}
............................................................
<form name="form1" action="" method="post" >
<div id="display" > you; </div>
<input type="button" name="Submit" value="submt" onClick="Compute()">
</form>
..........................................................
But the model will not work on mobile phone or PDA. how to get it? thanks a lot
Re: How to display the content on same page?
[QUOTE=youzx;336381]hello,
I want to display the content on same web page dynamicly. but I can't find the way. the model likes:
_______________
| |
| display area |
|______________|
Submit
Every time when I click the button [Submit], the content will reflesh. but all these will only take place on client. Not running on the server. we know it is easy on PC just like:
................................................................
function Compute()
{
var string;
string="<table><tr><td>"+Math.random()+"</td></tr></table>";
document.getElementById("display").innerHTML=string;
}
............................................................
<form name="form1" action="" method="post" >
<div id="display" > you; </div>
<input type="button" name="Submit" value="submt" onClick="Compute()">
</form>
..........................................................
But the model will not work on mobile phone or PDA. how to get it? thanks a lot[/QUOTE]
you forgot to place your script inside <script> tag.The correct code is:
[code]
<script>
function Compute()
{
var string;
string="<table><tr><td>"+Math.random()+"</td></tr></table>";
document.getElementById("display").innerHTML=string;
}
</script>
<form name="form1" action="" method="post" >
<div id="display" > you; </div>
<input type="button" name="Submit" value="submt" onClick="Compute()">
</form>
[/code]
I've just tested it and it actually works here using Opera browser for S60.The page generates a random number each time "Submit" is pressed.
But of course, it'll depend on the phone whether it'll work.Even if phone browser has javascript support, it might not work.
All S60 phones that have javascript support in the "Services" browser don't support most scripts
best regards
Re: How to display the content on same page?
Thanks a lot.
Later I will test it on higher version browser. But would you like to tell which browsers on mobile phone have supported the ecmascript?
Re: How to display the content on same page?
[QUOTE=youzx;337062]...But would you like to tell which browsers on mobile phone have supported the ecmascript?[/QUOTE]
-All the built-in browsers of S60 2nd edition Feature Pack 2 phones onwards: phones like 6680, 6681, N70, N90, N80, N73, N95, 3250.i don't know about S60 2nd edition Feature Pack 1
-Opera and NetFront for S60 (NetFront isn't available for S60 3rd edition)
Another one is Opera Mini (java application).But it can't execute local javascripts like the one you've posted before
best regards
Re: How to display the content on same page?
Ok, I see. thanks a lot.
I want to test the related code. do you know where I can download the simulator whose browser supports the ecmascript?
Re: How to display the content on same page?
what's the target phone you want to test the code?
best regards