/    Sign up×
Community /Pin to ProfileBookmark

conflict between reload and reveal

Hello everybody,

I have a conflict between 2 scripts, and I need both to work. I need reload on resize for a dropdown menu repositioning. The second script will reveal more options in a form, this one doesn’t work properly. Here is teh code:

<!DOCTYPE HTML PUBLIC “-//W3C//DTD HTML 4.01 Transitional//EN” “http://www.w3.org/TR/html4/loose.dtd“>
<html>
<head>
<script type=”text/javascript”>
function reDo(){ window.location.reload() }
window.onresize = reDo;
</script>
<script language=”JavaScript1.2″ type=”text/JavaScript1.2″ >

function controlHide_02() {
var max=1; //Number of sub sections
for(i=1;i<=max;i++){
var theId=’Print’+i;
var sub =document.getElementById(‘Print’ + i);
if (sub != null)
{
sub.style.display = ‘none’;

}
}

}

function controlExpand_02(which) {
var max=1; //Number of sub sections
for(i=1;i<=max;i++){
var theId=’Print’+i;
var sub =document.getElementById(‘Print’ + i);
if (sub != null)
{
if (sub.style.display != ”)
{
sub.style.display = ”;
}
else
{
sub.style.display = ‘none’;
}
}
}
}

</script>
<meta http-equiv=”Content-Type” content=”text/html; charset=iso-8859-1″>
<title>Untitled Document</title>
</head>

<body>
<table border=”0″ cellspacing=”3″ class=”little”>
<tr>
<td width=”50%” valign=”top”>I have a project involving the following services:</td>
<td><input type=”checkbox” name =”Project-Print” value=”” onclick=”controlExpand_02();” />
Print Services</td>
</tr>

<tbody id=”Print1″ style=”display:none”>
<tr>
<td colspan=”2″ valign=”top”><h3>Print Department</h3></td>
</tr>
<tr>
<td valign=”top”>Quantity:</td>
<td><input name=”PrintQuantity” type=”text” class=”formfield” /></td>
</tr>
</tbody>
</table>
</body>
</html>

Thanks!

to post a comment
JavaScript

9 Comments(s)

Copy linkTweet thisAlerts:
@NileshXYZJun 15.2005 — try putting the reDo() function in the <body> tag.
Copy linkTweet thisAlerts:
@LigiaauthorJun 15.2005 — I tried reload, resize in teh <body>, that will make the second script not to function, the page is refreshed and the portion which should be revealed is hidden again. I tried many things, for some reason I think the best would be to have 2 separate scripts outside the body tag.
Copy linkTweet thisAlerts:
@NileshXYZJun 15.2005 — woops, that is strange. not sure whats up with it.
Copy linkTweet thisAlerts:
@LigiaauthorJun 15.2005 — So you couldn't see the problem?
Copy linkTweet thisAlerts:
@NileshXYZJun 15.2005 — Ligia,

It works good in Firefox, yet in IE its giving some problems.

...below is what i ment about using the onresize in body tag...
<i>
</i>&lt;!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd"&gt;
&lt;html&gt;
&lt;head&gt;

&lt;script language="javascript1.2" type="text/javascript"&gt;
function controlHide_02() {
var max=1; //Number of sub sections
for(i=1;i&lt;=max;i++){
var theId='Print'+i;
var sub =document.getElementById('Print' + i);
if (sub != null)
{
sub.style.display = 'none';

}
}
}


function controlExpand_02() {
var max=1; //Number of sub sections
for(i=1;i&lt;=max;i++){
var theId='Print'+i;
var suba = document.getElementById('Print' + i);
if (suba != null){
if (suba.style.display != '') {
suba.style.display = '';
}
else {
suba.style.display = 'none';
}
}
}

}

function reDo(){
alert ('IE sucks');
window.location.reload ;
}
// window.onresize = reDo;



&lt;/script&gt;
&lt;meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1"&gt;
&lt;title&gt;Untitled Document&lt;/title&gt;
&lt;/head&gt;
&lt;body onResize="reDo();"&gt;

&lt;table border="0" cellspacing="3" class="little"&gt;
&lt;tr&gt;
&lt;td width="50%" valign="top"&gt;I have a project involving the following services:&lt;/td&gt;
&lt;td&gt;&lt;input type="checkbox" name ="Project-Print" value="" onMouseUp="controlExpand_02();" /&gt;
Print Services&lt;/td&gt;
&lt;/tr&gt;

&lt;tbody id="Print1" style="display:none"&gt;
&lt;tr&gt;
&lt;td colspan="2" valign="top"&gt;&lt;h3&gt;Print Department&lt;/h3&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;tr&gt;
&lt;td valign="top"&gt;Quantity:&lt;/td&gt;
&lt;td&gt;&lt;input name="PrintQuantity" type="text" class="formfield" /&gt;&lt;/td&gt;
&lt;/tr&gt;
&lt;/tbody&gt;
&lt;/table&gt;
&lt;/body&gt;
&lt;/html&gt;

Copy linkTweet thisAlerts:
@LigiaauthorJun 15.2005 — Thanks, but the code is not Valid HTML 4.01 Transitional:

[INDENT]Line 49, column 15: there is no attribute "ONRESIZE"

<body onResize="reDo();">[/INDENT]


I need the page to be valid. I don't know what to do...
Copy linkTweet thisAlerts:
@griff777Jun 19.2005 — Thanks, but the code is not Valid HTML 4.01 Transitional:

[INDENT]Line 49, column 15: there is no attribute "ONRESIZE"

<body onResize="reDo();">[/INDENT]


I need the page to be valid. I don't know what to do...[/QUOTE]



Sometimes, css can do what you want. Set the width to a percent, and for somethings, like images, which are notably difficult to dynamically resize, you'll need to script it.

Try this site. It uses dynamic resize for the images, and tell me if that is what you want.

http://jdgsoftco.no-ip.com/stare.php

This example site is a bit racey, so beware. Open the site, then after the images load, try resizing your browser window. It works with IE and FF, but uncertain if other browsers work with it.
Copy linkTweet thisAlerts:
@JPnycJun 19.2005 — I've had this same problem, onresize prevents the page from validating. Here's how I got around it:

window.onresize = function() { myFunctionNameGoesHere() };

Put that inside your script tags before the function. the page will validate.

Instead of resizing to fix dropdown menu positioning, why not capture mouse coordinates and base the postioning on that? It would have to be correct if they've moused over the triggering element.
Copy linkTweet thisAlerts:
@griff777Jun 19.2005 — I've had this same problem, onresize prevents the page from validating. Here's how I got around it:

window.onresize = function() { myFunctionNameGoesHere() };

Put that inside your script tags before the function. the page will validate.

Instead of resizing to fix dropdown menu positioning, why not capture mouse coordinates and base the postioning on that? It would have to be correct if they've moused over the triggering element.[/QUOTE]


Just wanted to thank you... Your solution is much simpler than the one I had used.
×

Success!

Help @Ligia spread the word by sharing this article on Twitter...

Tweet This
Sign in
Forgot password?
Sign in with TwitchSign in with GithubCreate Account
about: ({
version: 0.1.9 BETA 6.18,
whats_new: community page,
up_next: more Davinci•003 tasks,
coming_soon: events calendar,
social: @webDeveloperHQ
});

legal: ({
terms: of use,
privacy: policy
});
changelog: (
version: 0.1.9,
notes: added community page

version: 0.1.8,
notes: added Davinci•003

version: 0.1.7,
notes: upvote answers to bounties

version: 0.1.6,
notes: article editor refresh
)...
recent_tips: (
tipper: @nearjob,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,

tipper: @meenaratha,
tipped: article
amount: 1000 SATS,
)...