|
|
|||||||||
|
|||||||||
|
|||||||||
| |
|||
| |||||||||
![]() |
|
|
«
Previous Thread
|
Next Thread
»
|
Thread Tools | Search this Thread | Display Modes |
|
|
|
Free Web 2.0 Code Generator! Generate data entry and reporting .NET Web apps in minutes. Quickly create visually stunning, feature-rich apps that are easy to customize and ready to deploy. Download Now!
|
|
#1
|
|||
|
|||
|
Resizing an iFrame on a ONCLICK event
Hi, i'm creating a shopping site with a shopping cart that goes through an affiliate program on another site. The catalog is on my site, but the shopping cart is on the other site. I don't want the customer to loose their browsing page when they click "buy", but I can't have a new window open up everytime either, making multiple shopping carts.
So I decided to create an iFrame. When they are browsing, the shopping cart iFrame would be invisible, but when they click "buy" it would enlarge the shopping cart iFrame, and leave just enough space for a backlink to browsing that would, when clicked, bring the user back to my site and make the shopping cart iframe invisible again. A person in another forum told me the following, but I have no clue on how to implement it. Quote:
Any help would be greatly appreciated ![]() |
|
#2
|
||||
|
||||
|
specify
hello.
take in account this: when you set the display property to none, the element is hidden, when you set it to "", the element appear, check this on your functions. please, specify what code appertain to the show function and what to the hide function. regards klur |
|
#3
|
|||
|
|||
|
Ok, here is what I have so far.
Code:
<html>
<head>
<title></title>
<script language="javascript">
<!-- hide me
var sc = document.getElementById('shop');
-->
</script>
</head>
<body bgcolor='white'>
<iframe id="shop" name="shop" src="http://bluerobot.com" style="height: 100px; width: 100%;"></iframe>
<a href="#" onClick="sc.style.height='200px'; return false;">Red</a>
</body>
</html>
I am trying to assign the variable "sc" to the iframe "shop". Then, onclick, change the height of sc (which now should be the iFrame) to 200px. |
|
#4
|
|||
|
|||
|
I've done similar work using the lines of codes found here:
http://guymal.com/mycode/iframe_size.shtml but, as I recall.. You will not be able to resize the iframe according to an off-site webpage. I got some sort of javascript security error when I tried in the past. |
![]() |
| Viewing: Dev Articles Community Forums > Programming > JavaScript Development > Resizing an iFrame on a ONCLICK event |
| Thread Tools | Search this Thread |
| Display Modes | Rate This Thread |
|
|
|
|