【发布时间】:2013-01-15 16:50:24
【问题描述】:
我有一个包含 div> 的 html 文件,并且我正在加载到 UIWebView 中,我需要知道 div 中有多少行文本,所以我可以使用 javascript 检查:
<script>
function countLines() {
var divHeight = document.getElementById('myDiv').offsetHeight;
var lineHeight = parseInt(document.getElementById('myDiv').style.lineHeight);
var lines = divHeight / lineHeight;
alert("Lines: " + lines);
}
</script>
它确实会提醒变量“行”
在 Objective-C 中,如何从我的 UIWebView 中检索此变量,然后在我的代码中使用它?
谢谢!
【问题讨论】:
标签: javascript ios objective-c variables