如何在Javascript中重新分配图像 [英] How Do I Reassign The Image In Javascript

查看:55
本文介绍了如何在Javascript中重新分配图像的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

HEllo团队,

因为我在IIS中有多个图像列表。保存第一个图像的所有记录后,我想用第一个记录显示第二个图像。第一个图像正在工作但保存第一个图像的所有记录后我看不到第二个图像,因为我可以看到第二个图像的第一个记录。我问题是如何设置第二个图像?

我的代码如下:

i有javascript功能,如下图所示:



HEllo Team,
As i have number of images list in IIS. After saving all the records of first image ,i want to show the second image with first record.first image is working but after saving all the records of first image i cannot see second image as i can see the first record of second image.My question is how to set the second image??
I have the code as follow:
i have the function in javascript as follow to get the image:

function GetNextRecordCollection() {
               debugger;
               $.ajax({
                   url: 'Default.aspx/GetNextRecordCollection',
                   type: 'POST',
                   contentType: 'application/json; charset=utf-8',
                   dataType: "json",
                   success: function (result) {
                       if (result.d != '') {
                           debugger;
                           /*getting converted into arrayObject*/
                           customerLoanOcrList = JSON.parse(result.d);
                           if (customerLoanOcrList != '' && customerLoanOcrList != null && customerLoanOcrList.length > 0) {
                               $('#RawImageForOCR').attr("src", customerLoanOcrList[0].FileName);
                               ocrListIndex = 0;
                               setFormFields(customerLoanOcrList[ocrListIndex]);
                               recordLength = customerLoanOcrList.length;
                               scrolled = minTopScroll;
                               if (customerLoanOcrList[ocrListIndex].RecordNo > 1) {
                                   scrolled = scrolled * customerLoanOcrList[ocrListIndex].RecordNo;
                               }

                               SetInitialScroll();
                           }

                           manageOverlay(false);
                       }
                   },
                   error: function (error) {
                       manageOverlay(false);
                       alert(error.responseText);
                   },
                   async: false
               });
           };



i已在WebConfig中设置图像路径如下:

< appsetting>


i have set the images path in WebConfig as follow:
<appsetting>

<add key="OCRIMAGEPATH" value="http://localhost/OCRIMAGES//"/>
</appSettings>









#RawImageForOCR.attr(src) ,customerLoanOcrList [0] .FileName);

i可以看到第二个图像文件名但我看不到我网页上的图像。





请指导我。

谢谢

Harshal Raut




In the
#RawImageForOCR.attr(src, customerLoanOcrList[0].FileName);
i can see the second image filename but i cant see the image on my webpage.

.
Please kindly Guide me .
Thanks
Harshal Raut

推荐答案

.ajax({
url:' Default.aspx / GetNextRecordCollection'
类型:' POST'
contentType: ' application / json; charset = utf-8'
dataType: json
成功:函数(结果){
if (result.d!= ' '){
debugger;
/ * 转换为arrayObject * /
customerLoanOcrList = JSON.parse( result.d);
if (customerLoanOcrList!= ' '&& customerLoanOcrList!= null && customerLoanOcrList.length > 0 ){
.ajax({ url: 'Default.aspx/GetNextRecordCollection', type: 'POST', contentType: 'application/json; charset=utf-8', dataType: "json", success: function (result) { if (result.d != '') { debugger; /*getting converted into arrayObject*/ customerLoanOcrList = JSON.parse(result.d); if (customerLoanOcrList != '' && customerLoanOcrList != null && customerLoanOcrList.length > 0) {


' #RawImageForOCR')。attr( src,customerLoanOcrList [ 0 ]文件名);
ocrListIndex = 0 ;
setFormFields(customerLoanOcrList [ocrListIndex]);
recordLength = customerLoanOcrList.length;
scrolled = minTopScroll;
if (customerLoanOcrList [ocrListIndex] .RecordNo > 1 ){
scrolled = scrolled * customerLoanOcrList [ocrListIndex] .RecordNo;
}

SetInitialScroll();
}

manageOverlay( false );
}
},
错误:函数(错误){
manageOverlay( false );
alert(error.responseText);
},
async false
});
};
('#RawImageForOCR').attr("src", customerLoanOcrList[0].FileName); ocrListIndex = 0; setFormFields(customerLoanOcrList[ocrListIndex]); recordLength = customerLoanOcrList.length; scrolled = minTopScroll; if (customerLoanOcrList[ocrListIndex].RecordNo > 1) { scrolled = scrolled * customerLoanOcrList[ocrListIndex].RecordNo; } SetInitialScroll(); } manageOverlay(false); } }, error: function (error) { manageOverlay(false); alert(error.responseText); }, async: false }); };



i已在WebConfig中设置图像路径如下:

< appsetting>


i have set the images path in WebConfig as follow:
<appsetting>

<add key="OCRIMAGEPATH" value="http://localhost/OCRIMAGES//"/>
</appSettings>









#RawImageForOCR.attr(src) ,customerLoanOcrList [0] .FileName);

i可以看到第二个图像文件名但我看不到我网页上的图像。





请指导我。

谢谢

Harshal Raut




In the
#RawImageForOCR.attr(src, customerLoanOcrList[0].FileName);
i can see the second image filename but i cant see the image on my webpage.

.
Please kindly Guide me .
Thanks
Harshal Raut


试试这个

Try this


这篇关于如何在Javascript中重新分配图像的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆