Hello and welcome to our community! Is this your first visit?
Register
Enjoy an ad free experience by logging in. Not a member yet? Register.
Results 1 to 3 of 3
  1. #1
    New Coder
    Join Date
    Mar 2012
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts

    picture display problem in iframe

    Code:
    window.onload = function() 
    	{
    		var vIframeUrl;
    		vIframeUrl= document.getElementById("ifrBDiagram").src;
    		
    		if (vIframeUrl == "#" && document.getElementById("txtBnr").value == "")
    		{
    			document.getElementById("ifrBDiagram").src = "C://eBondingDiagram//Infineon.jpg";
    		}
    		getIframeSize(); 
    	} 
    
    function getIframeSize()
    	{
    		//Get window width and height
    		var winW = 630, winH = 460;
    		if (document.body && document.body.offsetWidth) { 
    			winW = document.body.offsetWidth;
    			winH = document.body.offsetHeight;
    		}
    		if (document.compatMode=='CSS1Compat' &&
    			document.documentElement &&
    			document.documentElement.offsetWidth ) {//alert("in 2");
    			winW = document.documentElement.offsetWidth;
    			winH = document.documentElement.offsetHeight;
    		}
    		if (window.innerWidth && window.innerHeight) {//alert("in 3");
    			winW = window.innerWidth;
    			winH = window.innerHeight;
    		}
    		
    		document.getElementById("ifrBDiagram").width = (winW * 0.95);
    		document.getElementById("ifrBDiagram").height = (winH * 0.88);
    	}
    Code:
    <table width="100%" height="100%" bgcolor="#CAD4E3" align="center" valign="center" style="border: 5px solid;">
    	<tr>
    		<td><b>Bnr No:</b></td>
    		<td><input type="text" id="txtBnr" name="txtBnr" /></td>
    		<td> </td>
    		<td> </td>	
    	</tr>
    	<tr>
    		<td><b>Lot No:</b></td>
    		<td><input type="text" id="txtLot" name="txtLot" /></td>
    		<td><INPUT id="btnCopy" TYPE="button" VALUE="Bonding Diagram" ONCLICK="fncCopy()">&nbsp;&nbsp;<INPUT id="btnUpdate" TYPE="button" VALUE="End Lot" ONCLICK="reloadPage()"></td>
    		<td> </td>
    	</tr>
    	<tr>
    		<td><b>Failure Catalogues:</b></td>
    		<td><select id="myList">
    			<option></option>
    			<option>DSO</option>
    			<option>Pre-Assembly</option>  
    			<option>PO EOL</option>
    			<option>TDSON/TSDSON</option>
    			<option>S308/WISON</option>
    			</select>
    		</td>
    		<td><INPUT id="btnCata" TYPE="button" VALUE="Failure Catalogue" ONCLICK="fcnFailureCatalogue()"></td>
    		<td> </td>	
    	</tr>
    	<tr>
    		<td colspan="4">
    			<iframe name="ifrBDiagram" id="ifrBDiagram" src=# style="border-width:4px; border-style:solid; border-color:blue;">
    				<span id="sMsg"></span>
    			</iframe>
    		</td>
    	</tr>
    </table>
    When I first run the html , the interface just goes like this.



    After I press F5 to refresh the window, it displays this. The image just wont fit the iframe exactly.


    Can anyone please help to spot the bug ? I tried to use different resolution picture but still, the problem just doesn't solve. Is it really because of the image resolution ? Or something else gone wrong in my html ? Thanks
    Last edited by Jian0203; 03-28-2012 at 03:22 AM.

  • #2
    Supreme Master coder! Old Pedant's Avatar
    Join Date
    Feb 2009
    Posts
    25,166
    Thanks
    75
    Thanked 4,338 Times in 4,304 Posts
    Are we supposed to guess what code is in getIframeSize()??
    An optimist sees the glass as half full.
    A pessimist sees the glass as half empty.
    A realist drinks it no matter how much there is.

  • #3
    New Coder
    Join Date
    Mar 2012
    Posts
    52
    Thanks
    2
    Thanked 0 Times in 0 Posts
    Quote Originally Posted by Old Pedant View Post
    Are we supposed to guess what code is in getIframeSize()??
    Sorry, i missed out one part. Updated ~


  •  

    Posting Permissions

    • You may not post new threads
    • You may not post replies
    • You may not post attachments
    • You may not edit your posts
    •