﹎斑斓的梦ぷ

愿你眼中总有光芒,活成你想要的模样.

导航

Javascript - 截取字符串

str.split("xxx")

<input type="hidden" value='' id="bgimgid">
<script>
	var str = '/app/upload/image/survey/bg476.jpg';
	var arr = new Array();
	arr = str.split("/");
	if(arr.length > 1){
		var result = arr[arr.length-2];
		document.getElementById("bgimgid").value = result;
	}
</script>

posted on 2018-05-25 14:05  ﹎斑斓的梦ぷ  阅读(102)  评论(0编辑  收藏  举报