473,378 Members | 1,321 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,378 software developers and data experts.

how to refresh the page?

<img src=...Onlick = "if (!(this.temp>=640)) { this.temp=640; } if
(this.width>=640) { xyz=this.width; this.width=this.temp;
this.temp=xyz; }">

Inline script....
I got the above code from internet and it is used to change the width
of the IMG element. This not only "changes" the width but also
"refreshes" the page so that I can see the change in width.

Function script...
I moved above inline script to a JS file and it is as follows. Now,
'width' of the IMG element seem to change but display does not get
refreshed; and if I add a window.alert( ); then I see screen
refreshing

function Show()
{
iImageWidth = 640;
if(document.getElementById) //gecko(NN6) + IE 5+
{
var obj = document.getElementById("IndividualImageID");
if (!(obj.LastWidth>=iImageWidth))
{
'window.alert( 'obj.LastWidth = ' + obj.LastWidth ); //Uncommenting
this line would
//
display image with new width
obj.LastWidth=iImageWidth;
}
if (obj.width>=iImageWidth)
{
'window.alert( 'obj.LastWidth1 = ' + obj.LastWidth ); //Uncommenting
this line would
//
display image with new width

xyz=obj.width;
obj.width=obj.LastWidth;
obj.LastWidth=xyz;
}
}
}

Please let me know how can I make this script refresh.

Thanks
Ramesh

May 23 '07 #1
2 1897
as*******@gmail.com wrote:
<img src=...Onlick = "if (!(this.temp>=640)) { this.temp=640; } if
(this.width>=640) { xyz=this.width; this.width=this.temp;
this.temp=xyz; }">
Hi,

The above code is strange:
onLick event?
Does that handler fire when a client licks that image?

Anyway, assuming onClick(): The above code stores the width of the image in
a freshly made property named temp.
If not set, it defaults to 640. If clicked again it switches back to
original format.
>
Inline script....
I got the above code from internet and it is used to change the width
of the IMG element. This not only "changes" the width but also
"refreshes" the page so that I can see the change in width.
As far as I can see, no refreshing is done. At least not in the above code.
And refreshing the page would certainly result in a new page and thus in
loosing the property named temp for that image.
Same goes for every variable in JavaScript. They are all lost if the page is
refreshed unless you take special precautions, like storing things in
COOKIE or encoding stuff in GET, like:

location='mypage.html?temp=640';

So refreshing is a bad idea, at least in the situation you described.

Regards,
Erwin Moller
May 23 '07 #2
Jim
I'm not sure what your problem in your code is. I just built and ran
the following:

--play.htm--

<html><head>
<script src='play.js' language="JavaScript" type="text/javascript" ></
script>
</head><body>
<img src='winter.jpg' onclick='swapsize(this);' ></img>
</body></html>

--play.js--

function swapsize(el)
{
if (el.width==800) {
el.width=400;
el.height=300;
}
else {
el.width=800;
el.height=600;
}
}

Yes, it's simple. Point is, there is no 'refresh', no round trip to
the server. All that happens is the image changes sizes.

That is what you were looking for, right?

J

May 23 '07 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

3
by: Scott | last post by:
I have a clickable graph that resides on page 1. If user clicks a data point on the graph, the page runs again yeilding a 2nd graph that shows a more detailed graph. Problem is, I have a...
1
by: Marco Maroni | last post by:
How to force image refresh on client browser ? Is ti possible to force the refresh of the same image (tha was changed server-side) to the client, without user press Contrl+F5 in IE ? - Marco
2
by: Jeronimo Bertran | last post by:
Hi, I have a page with a very data intensive grid which needs to be automatically refreshed constantly if a change is detected. In order to not refresh the complete page so often, I created an...
1
by: francois | last post by:
I have a ASPX form with a dropdownlist that makes a post back (to the same page of course, just a normal asp.net postback) That page also has an auto refresh javascript as it needs to refresh its...
9
by: PK9 | last post by:
I'm having an issue with the "Refresh" of an asp.net page. The refresh is actually calling my last onClick event. I thought that asp.net was supposed to be stateless in that it shouldn't...
0
by: Brad White | last post by:
Overview: I have a custom web app that has an 'Inbox' that refreshes every 30 seconds. One user uses Outlook to host the web page. Using IE, the refresh works fine. If the user is working in...
3
by: Kevin | last post by:
Hi guys, I want to refresh some pages every 2 seconds. however, these html pages are not in my site, they could be any pages from yahoo.com or msn.com. I can create a page, which redirect to...
8
by: Jason S | last post by:
Hi, is there any way of getting my VB (6.0) program to automatically 'Refresh' an IE window that might be active (window status not applicable). It needs to be able to determine which active IE...
10
by: phforum | last post by:
Hi, I wrote a PHP page for user input the information to search the database. And the database data will update every second. I want to set the auto refresh to get the data from database every...
5
by: =?Utf-8?B?Sm9obg==?= | last post by:
Hi, I used the following code to refresh the parent page, and it works very well (Thanks to Peter Bromberg "). Response.Write("<script language='javascript' type='text/javascript'{...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.