Jump to content

HTML/JavaScript on mobiles


Iconiq

Recommended Posts

Hey all,I've written a small stand alone html page. It accepts 3 values, and gives one output. The processing is done using Javascript. The problem is that it runs on my Samsung A701, but won't run on the LG phones in my company. Can anyone give me some advice on how to get the LG phones to run it? All I’ve done is saved the HTML file onto my phones memory card, then the Samsung opens the file in its browser.Any help will be greatly appreciated. This is the code i'm using:

<html><head><script type="text/javascript">function calculate(){ if (IsNumeric(cal.diameter.value) == false || IsNumeric(cal.dish.value) == false || IsNumeric(cal.circ.value) == false){ alert("Use only numbers!")} else{  var answer = Math.pow((parseFloat(cal.diameter.value)/2),2);  answer = parseFloat(answer) * Math.PI;  answer = parseFloat(answer) *  (parseFloat(cal.circ.value) + parseFloat(cal.dish.value));  <!-- Rounds off to 2 decimal places  answer /= 1000000;  answer *= 100  answer = Math.round(answer)  answer /=100     alert("Capacity " + answer + " Litres.")}}function IsNumeric(sText){   var ValidChars = "0123456789.";   var IsNumber=true;   var Char;    for (i = 0; i < sText.length && IsNumber == true; i++)       {       Char = sText.charAt(i);       if (ValidChars.indexOf(Char) == -1)          {         IsNumber = false;         }      }   return IsNumber;      }</script></head><body><form name="cal"><Table border=fixed><tr>  <td>Enter diameter: </td>   <td><input type="text" name="diameter" value=0></td></tr><tr>  <td>Enter Distance between circ welds: </td>   <td><input type="text" Id="circ" value=0></td></tr><tr>  <td>Enter Length of 1 dish: </td>   <td><input type="text" Id="dish" value=0></td></tr></Table><input type="button" value="Calculate" onclick="calculate()"></body></html>

Iconiq

Link to comment
Share on other sites

You need to find out which technologies the LG phones support.
The only thing i can find is that it supports wap 2.0 and Java 2.0, The phones can browes the internet fine, i just don't know how to get them to run a file that is on their memory... It should support it running WAP 2.0 right?
Link to comment
Share on other sites

I'm not sure, I haven't looked at the specification for WAP 2.0. WAP is a protocol, and the protocol would not come into play for loading something from local memory. The protocol is for communicating over a network, it doesn't have anything to do with the actual files being transferred. The files are presumably written in WML or XHTML, so I would assume that a device would be able to load a local WML file into the browser and render it.

Link to comment
Share on other sites

:) Yeah, that sounds good. I'll try it in xhtml, and see if that works. What worries me is that it looks like the phone has no option to open a local file... Its not that its opening it and not running correctly, :) its just not running... Thanx for your help mate.
Link to comment
Share on other sites

I've recently been developing and as previously mentioned do try and find outwhat specifications the phones are happy with.Sometimes some phones aren't happy with some notation.Like what I'm developing right now is supposed to be suited for TV and phone.I found out that when linking on websites something like href="/hello.jpg" forexample would work on the TV and Comp. screen but not on my Nokia I'm usingfor testing. But if I take out the slash and make it this href="hello.jpg"then praise the lord it works. That took me days to work out. :) So make sure you make your code as compatible as possible.Especially as phones tend to only 'emulate' javascript.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...