我在jsp文件中有JSON对象数据,我已通过超链接onclick方法将此数据传递给javascript函数。我在javascript函数中编写警报框,因此它显示得很好,但问题是我想提取JSON对象中的 url 并转换为数组。
javascript函数中的实际数据如下...
[Image{url='/images/HH/Images/US/NYC/NYC-MEL-1.jpg', description='Exterior', alt='null', sortOrder=1, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-9.jpg', description='Exterior', alt='null', sortOrder=1, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-11.jpg', description='Lobby', alt='null', sortOrder=4, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-5.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-6.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-7.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-8.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-10.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-3.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-2.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}, Image{url='/images/HH/Images/US/NYC/NYC-MEL-4.jpg', description='Guest Room', alt='null', sortOrder=34, externalUrl='null'}]
上面的文本包含的List
对象Image
包含 urls 和 alt 以及描述等...
我需要解决方案javascript
来迭代java脚本中的url并转换为数组..
请你能给我建议答案吗....
谢谢 Ram Prasad G 08527960397