2014年9月5日 星期五

iframe依內容自動調整框架高度



iframe.html

<iframe frameborder="0" src="source.htm" id="frameid" onload="javascript:reSize()"></iframe>

※參考來源的教學,直接使用只有Google Chrome可以運作,IE, FF不會動,因此要加上上述紅字的部分。

</script>(加在<head>....</head>之間

<script language="javascript">
function reSize(){
  //parent.document.all.frameid.height=document.body.scrollHeight;
  parent.document.getElementById("frameid").height=document.body.scrollHeight;
}
window.onload=reSize;
</script>
 


參考來源:http://www.minwt.com/js/112.html

Parse the Uri string into name-value collection in java


public static Map<String, List<String>> splitQuery(URL url) throws UnsupportedEncodingException {
  final Map<String, List<String>> query_pairs = new LinkedHashMap<String, List<String>>();
  final String[] pairs = url.getQuery().split("&");
  for (String pair : pairs) {
    final int idx = pair.indexOf("=");
    final String key = idx > 0 ? URLDecoder.decode(pair.substring(0, idx), "UTF-8") : pair;
    if (!query_pairs.containsKey(key)) {
      query_pairs.put(key, new LinkedList<String>());
    }
    final String value = idx > 0 && pair.length() > idx + 1 ? URLDecoder.decode(pair.substring(idx + 1), "UTF-8") : null;
    query_pairs.get(key).add(value);
  }
  return query_pairs;
}

Ref. http://stackoverflow.com/questions/13592236/parse-the-uri-string-into-name-value-collection-in-java