开发者

image source in not dynamic action in html

HTML view source code is:

<IMG style="DISPLAY: inline" src="https://admit.belgacom.be/WCE/ESW/img/load.gif" />

but When i login and reach this location, path is showing different as: (ESW is missing)

<IMG st开发者_开发百科yle="DISPLAY: inline" src="https://admit.belgacom.be/WCE/img/load.gif" />

Due to change of path, ie without ESW image is not getting loaded.

Note: I have javascript code in JSP where it replaces the new image due to IE settimeout issue as:

document.getElementById('imageId').src = \"../../img/load.gif\");

CODE:

<div id="toHide" class="pb-text-align-center">
    <img style="display: inline" id='imageId' src="img/load.gif" />
    <form wicket:id="safeForm" class="clearfix">
        <input type="hidden" wicket:id="submitted" value="false" />
    </form>
</div>  

<SCRIPT type="text/javascript"> 
    function setSubmit(){
    document.getElementById("safeForm4c").submit();  
    document.getElementById('imageId').src = "../../img/load.gif"; }
    if (document.getElementById("safeForm4c").submitted.value == "false") {
        document.getElementById("safeForm4c").submitted.value = "true";
        setTimeout('setSubmit()', 100); 
    }else{ document.getElementById("toHide").style.display="none";}
</SCRIPT>


I solved by assigning dynamic image path instead of ../../img/load.gif as:

//document.getElementById('imageId').src = \"../../img/load.gif\");

document.getElementById('imageId').src = document.getElementById('imageId').src;

<SCRIPT type="text/javascript"> 
        function setSubmit(){
        document.getElementById("safeForm4c").submit();  
        document.getElementById('imageId').src = document.getElementById('imageId').src; }
        if (document.getElementById("safeForm4c").submitted.value == "false") {
            document.getElementById("safeForm4c").submitted.value = "true";
            setTimeout('setSubmit()', 100); 
        }else{ document.getElementById("toHide").style.display="none";}
    </SCRIPT>


One possability is your file structure and relative locations, to give a complete answer on script issue or files structure we would need to see what you have in place.

Assuming that it isn't scripting, from your post it looks like the JavaScript is in a folder at the same level as img, for example, looking at the file structure I believe this is where your files are stored

/htdocs/WCE/ESW/img/load.gif is the path to your image

/htdocs/WCE/alt1/alt2/java.js is the path the src property is being referenced from

Now when i put in the ../../img/load.gif this will go back to /htdocs/WCE/img/load.gif cutting out the ESW folder.

If this is the case you will need to look at your file structures to work out the correct path (probably ../img/load.gif), if you have trouble post them here and I (or another here) can try to help you work the path out.

I hope this helps.

UPDATED AS A RESULT OF CODE ADDITION:

If your script is in the same page as your HTML try removing ../../ from your JavaScript

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜