I have the following code, and it works well on Mozilla 1.6. (However,
the image src property cannot be set on Mozilla 1.2.1).
Unfortunately, all the code:
document.images .itemImage.src = itemInfo.imageU rl;
//document.getEle mentById("itemI mage").src = itemInfo.imageU rl;
document.getEle mentById("descr ").innerHTM L = itemInfo.descr;
document.getEle mentById("price ").innerHTM L = itemInfo.price;
doesn't work on IE. What's the proper way to set them in IE?
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<title>popup</title>
<script src="items.js" language="JavaS cript"></script>
<script language="javas cript">
<!---
function show_details(ID ) {
var itemInfo = items.getARecor d(ID);
document.images .itemImage.src = itemInfo.imageU rl;
//document.getEle mentById("itemI mage").src = itemInfo.imageU rl;
document.getEle mentById("descr ").innerHTM L = itemInfo.descr;
document.getEle mentById("price ").innerHTM L = itemInfo.price;
}
//--->
</script>
</head>
<body onload="javascr ipt:show_detail s(opener.itemID );">
<table cellpadding="2" cellspacing="2" border="1"
style="text-align: left; width: 100%;">
<tbody>
<tr align="center">
<td style="vertical-align: top;"><img src="na.jpg" title=""
alt="Picture" ID="itemImage"/><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><div ID="descr"></div><br>
</td>
</tr>
<tr align="right">
<td style="vertical-align: top;"><div ID="price"></div>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><br>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html> 9 2288
"Nick" <nb**********@h otmail.com> wrote in message
news:c1******** **@news3.bu.edu ... I have the following code, and it works well on Mozilla 1.6. (However, the image src property cannot be set on Mozilla 1.2.1).
Unfortunately, all the code doesn't work on IE. What's the proper way to set them in IE?
With the code below, if there is an element with id "price" and an an
innerHTML property and an object itemInfo with a property price, then IE
will display it. Microsoft singlehandedly invented innerHTML so it would be
kinda strange if they suddenly stopped supporting it. Now I do see a nice
accessible div with id="price" below, so I guess the problem lies with the
itemInfo variables. Do you get the expected response if you write
alert(itemInfo. price) in the function?
<snip> <script language="javas cript"> <!--- function show_details(ID ) { var itemInfo = items.getARecor d(ID); document.images .itemImage.src = itemInfo.imageU rl; //document.getEle mentById("itemI mage").src = itemInfo.imageU rl; document.getEle mentById("descr ").innerHTM L = itemInfo.descr; document.getEle mentById("price ").innerHTM L = itemInfo.price; } //---> </script> </head> <body onload="javascr ipt:show_detail s(opener.itemID );">
You may drop the bit "javascript :". Unless you have specified a different
default content-type for scripts with a meta tag in the head, anything
inside the onload="..." will automatically be interpreted as javascript.
<snip> <td style="vertical-align: top;"><div ID="descr"></div><br> </td> </tr> <tr align="right"> <td style="vertical-align: top;"><div ID="price"></div>
<snip>
HTH
Ivo
Ivo wrote: "Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ...
I have the following code, and it works well on Mozilla 1.6. (However, the image src property cannot be set on Mozilla 1.2.1).
Unfortunately , all the code doesn't work on IE. What's the proper way to set them in IE?
With the code below, if there is an element with id "price" and an an innerHTML property and an object itemInfo with a property price, then IE will display it. Microsoft singlehandedly invented innerHTML so it would be kinda strange if they suddenly stopped supporting it. Now I do see a nice accessible div with id="price" below, so I guess the problem lies with the itemInfo variables. Do you get the expected response if you write alert(itemInfo. price) in the function?
Thanks, it turn out be the scope problem because I wrote:
<script src="items.js" language="JavaS cript"></script>
<script language="javas cript">
<!---
var imageSrc;
function show_details(ID ) {
var itemInfo = items.getARecor d(ID);
document.images .itemImage.src = itemInfo.imageU rl;
...
document.getEle mentById("price ").innerHTM L = itemInfo.price;
}
//--->
</script>
The items.js in the first <script> tag defined the object variable
items, which is global visibla in Mozilla, but the second <script> in IE
cannot see the variable. That's cause the problem.
I don't want to combine it into one because items.js will be a large
object variable definition. And the second <script> tag is for
"presentati on layer" so it had better go with the html code. Any
solution to make a javascript variable definition global in the whole html?
Btw, looks mozilla 1.2.1 doesn't support
document.images .itemImage.src = itemInfo.imageU rl;
But Mozilla 1.6 can run the above line without problem.
<snip>
<script language="javas cript"> <!--- function show_details(ID ) { var itemInfo = items.getARecor d(ID); document.imag es.itemImage.sr c = itemInfo.imageU rl; //document.getEle mentById("itemI mage").src = itemInfo.imageU rl; document.getE lementById("des cr").innerHTM L = itemInfo.descr; document.getE lementById("pri ce").innerHTM L = itemInfo.price; } //---> </script> </head> <body onload="javascr ipt:show_detail s(opener.itemID );">
You may drop the bit "javascript :". Unless you have specified a different default content-type for scripts with a meta tag in the head, anything inside the onload="..." will automatically be interpreted as javascript.
<snip>
<td style="vertical-align: top;"><div ID="descr"></div><br> </td> </tr> <tr align="right"> <td style="vertical-align: top;"><div ID="price"></div>
<snip>
HTH Ivo
"Nick" <nb**********@h otmail.com> wrote in message
news:c1******** **@news3.bu.edu ... Ivo wrote: "Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ... itemInfo variables. Do you get the expected response if you write alert(itemInfo. price) in the function? Thanks, it turn out be the scope problem because I wrote:
<script src="items.js" language="JavaS cript"></script> <script language="javas cript"> <!--- var imageSrc; function show_details(ID ) { var itemInfo = items.getARecor d(ID); document.images .itemImage.src = itemInfo.imageU rl; ... document.getEle mentById("price ").innerHTM L = itemInfo.price; } //---> </script>
The items.js in the first <script> tag defined the object variable items, which is global visibla in Mozilla, but the second <script> in IE cannot see the variable. That's cause the problem.
I don't want to combine it into one because items.js will be a large object variable definition. And the second <script> tag is for "presentati on layer" so it had better go with the html code. Any solution to make a javascript variable definition global in the whole
html?
Once a scriptfile is read, it becomes part of the page source. Any global
variables that you create in script.js are as global as the functions are
other things that may be in the file. I can't say without having seen
script.js why IE is not picking up the "items" variable while Mozila is. You
pass one variable to the show_details function, "opener.itemID" , why not the
"items" variable as well?
Ivo
Ivo wrote: "Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ...
Ivo wrote:
"Nick" <nb**********@h otmail.com> wrote in message news:c1***** *****@news3.bu. edu... itemInfo variables. Do you get the expected response if you write alert(itemIn fo.price) in the function?
Thanks, it turn out be the scope problem because I wrote:
<script src="items.js" language="JavaS cript"></script> <script language="javas cript"> <!--- var imageSrc; function show_details(ID ) { var itemInfo = items.getARecor d(ID); document.imag es.itemImage.sr c = itemInfo.imageU rl; ... document.getE lementById("pri ce").innerHTM L = itemInfo.price; } //---> </script>
The items.js in the first <script> tag defined the object variable items, which is global visibla in Mozilla, but the second <script> in IE cannot see the variable. That's cause the problem.
I don't want to combine it into one because items.js will be a large object variable definition. And the second <script> tag is for "presentati on layer" so it had better go with the html code. Any solution to make a javascript variable definition global in the whole
html?
Once a scriptfile is read, it becomes part of the page source. Any global variables that you create in script.js are as global as the functions are other things that may be in the file. I can't say without having seen script.js why IE is not picking up the "items" variable while Mozila is. You pass one variable to the show_details function, "opener.itemID" , why not the "items" variable as well? Ivo
Now I put everything in the html file (File is shown below), Mozilla 1.6
always works fine. But IE 6 always error. When using VS.Net debug, it
said that the fill_details is not defined and stop at the <body
onload="javascr ipt:fill_detail s(opener.itemID )...>.
It's so strange...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta http-equiv="content-type"
content="text/html; charset=ISO-8859-1">
<title>popup</title>
<!--script src="items.js" language="JavaS cript"></script-->
<script language="javas cript">
<!---
var items = {
Default : {descr:'n/a', price:'n/a', color:'n/a', imageDir:'', top:0,
left:0, width:350, height:350},
ring1 : {descr:'Ring 1 description.', price:120, color:'gold',
imageDir:'', top:100, left:100, width:300, height:350},
};
// Member methods
function getImageUrl(ID) {
return this[ID].imageDir + ID + '.jpg';
}
// Assign member methods
items.imageUrl = getImageUrl;
// Member method
function getARecord(ID) {
var result = {descr:this[ID].descr, price:this[ID].price,
color:this[ID].color, imageUrl:this.i mageUrl(ID),
left:this[ID].left, top:this[ID].top, width:this[ID].width,
height:this[ID].height};
return result;
}
items.getARecor d = getARecord;
function fill_details(ID ) {
var itemInfo = items.getARecor d(ID);
document.images .itemImage.src = itemInfo.imageU rl;
//document.getEle mentById("itemI mage").src = itemInfo.imageU rl;
document.getEle mentById("descr ").innerHTM L = itemInfo.descr;
document.getEle mentById("price ").innerHTM L = 'Price: ' + itemInfo.price;
if (itemInfo.width != 0 && itemInfo.height != 0)
window.resizeTo (itemInfo.width , itemInfo.height );
if (itemInfo.top != 0 && itemInfo.left != 0)
window.moveTo(i temInfo.left, itemInfo.top);
}
//--->
</script>
</head>
<body onload="javascr ipt:fill_detail s(opener.itemID );">
<table cellpadding="2" cellspacing="2" border="1"
style="text-align: left; width: 100%;">
<tbody>
<tr align="center">
<td style="vertical-align: top;"><img src="na.jpg" title=""
alt="Picture" ID="itemImage"/><br>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><div ID="descr"></div><br>
</td>
</tr>
<tr align="right">
<td style="vertical-align: top;"><div ID="price"></div>
</td>
</tr>
<tr>
<td style="vertical-align: top;"><br>
</td>
</tr>
</tbody>
</table>
<br>
</body>
</html>
Nick wrote: Ivo wrote:
"Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ...
Ivo wrote:
"Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ... itemInfo variables. Do you get the expected response if you write alert(itemInfo. price) in the function?
Thanks, it turn out be the scope problem because I wrote:
<script src="items.js" language="JavaS cript"></script> <script language="javas cript"> <!--- var imageSrc; function show_details(ID ) { var itemInfo = items.getARecor d(ID); document.images .itemImage.src = itemInfo.imageU rl; ... document.getEle mentById("price ").innerHTM L = itemInfo.price; } //---> </script>
The items.js in the first <script> tag defined the object variable items, which is global visibla in Mozilla, but the second <script> in IE cannot see the variable. That's cause the problem.
I don't want to combine it into one because items.js will be a large object variable definition. And the second <script> tag is for "presentati on layer" so it had better go with the html code. Any solution to make a javascript variable definition global in the whole
html?
Once a scriptfile is read, it becomes part of the page source. Any global variables that you create in script.js are as global as the functions are other things that may be in the file. I can't say without having seen script.js why IE is not picking up the "items" variable while Mozila is. You pass one variable to the show_details function, "opener.itemID" , why not the "items" variable as well? Ivo
Now I put everything in the html file (File is shown below), Mozilla 1.6 always works fine. But IE 6 always error. When using VS.Net debug, it said that the fill_details is not defined and stop at the <body onload="javascr ipt:fill_detail s(opener.itemID )...>.
It's so strange...
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN"> <html> <head> <meta http-equiv="content-type" content="text/html; charset=ISO-8859-1"> <title>popup</title> <!--script src="items.js" language="JavaS cript"></script--> <script language="javas cript"> <!--- var items = { Default : {descr:'n/a', price:'n/a', color:'n/a', imageDir:'', top:0, left:0, width:350, height:350}, ring1 : {descr:'Ring 1 description.', price:120, color:'gold', imageDir:'', top:100, left:100, width:300, height:350}, };
// Member methods function getImageUrl(ID) { return this[ID].imageDir + ID + '.jpg'; }
// Assign member methods items.imageUrl = getImageUrl;
// Member method function getARecord(ID) { var result = {descr:this[ID].descr, price:this[ID].price, color:this[ID].color, imageUrl:this.i mageUrl(ID), left:this[ID].left, top:this[ID].top, width:this[ID].width, height:this[ID].height}; return result; }
items.getARecor d = getARecord;
function fill_details(ID ) { var itemInfo = items.getARecor d(ID); document.images .itemImage.src = itemInfo.imageU rl; //document.getEle mentById("itemI mage").src = itemInfo.imageU rl; document.getEle mentById("descr ").innerHTM L = itemInfo.descr; document.getEle mentById("price ").innerHTM L = 'Price: ' + itemInfo.price; if (itemInfo.width != 0 && itemInfo.height != 0) window.resizeTo (itemInfo.width , itemInfo.height ); if (itemInfo.top != 0 && itemInfo.left != 0) window.moveTo(i temInfo.left, itemInfo.top); } //---> </script> </head> <body onload="javascr ipt:fill_detail s(opener.itemID );">
<table cellpadding="2" cellspacing="2" border="1" style="text-align: left; width: 100%;"> <tbody> <tr align="center"> <td style="vertical-align: top;"><img src="na.jpg" title="" alt="Picture" ID="itemImage"/><br> </td> </tr> <tr> <td style="vertical-align: top;"><div ID="descr"></div><br> </td> </tr> <tr align="right"> <td style="vertical-align: top;"><div ID="price"></div> </td> </tr> <tr> <td style="vertical-align: top;"><br> </td> </tr> </tbody> </table> <br> </body> </html>
never mind my previous message. The error is caused by a extra comma
when initialize the object items....
"Nick" <nb**********@h otmail.com> wrote in message
news:c1******** **@news3.bu.edu ... Nick wrote: Ivo wrote: "Nick" <nb**********@h otmail.com> wrote Ivo wrote: > "Nick" <nb**********@h otmail.com> wrote
<snip> never mind my previous message. The error is caused by a extra comma when initialize the object items....
It usually is.
Good luck, Ivo
Ivo wrote: "Nick" <nb**********@h otmail.com> wrote in message news:c1******** **@news3.bu.edu ...
Nick wrote:
Ivo wrote:
"Nick" <nb**********@h otmail.com> wrote
>Ivo wrote: > >>"Nick" <nb**********@h otmail.com> wrote
<snip>
never mind my previous message. The error is caused by a extra comma when initialize the object items....
It usually is. Good luck, Ivo
Thanks, but Mozilla doesn't have problem with the extra ",". And I even
thought use this feature because I will use spreadsheet/database to
generate the initialize javascript code and I wounldn't worry about the
last ",".
Anyway, this example also shows how difficult to debug javascript, even
with MS VS.Net....
Ivo wrote: "Nick" [...] wrote [...]:
Please do not write so-called attribution novels. Most of the
information in your attribution is superfluous as it is already
contained in the headers of the posting you reply to, while it
makes your posting and threads where your postings are quoted,
not as easy legible. <body onload="javascr ipt:show_detail s(opener.itemID );">
You may drop the bit "javascript :". Unless you have specified a different default content-type for scripts with a meta tag in the head, anything inside the onload="..." will automatically be interpreted as javascript.
No, only with UAs that use JavaScript as the default scripting language.
Thus standards-compliant HTML calls for explicitely specifying the
default scripting language to be used in values of intrinsic event
handler attributes:
<head>
...
<meta http-equiv="Content-Script-Type" content="text/javascript">
...
</head>
See <http://www.w3.org/TR/html4/interact/scripts.html#h-18.2.2>.
PointedEars
JRS: In article <40************ **@PointedEars. de>, seen in
news:comp.lang. javascript, Thomas 'PointedEars' Lahn
<Po*********@we b.de> posted at Mon, 5 Apr 2004 17:32:07 : Ivo wrote:
"Nick" [...] wrote [...]:
Please do not write so-called attribution novels. Most of the information in your attribution is superfluous as it is already contained in the headers of the posting you reply to, while it makes your posting and threads where your postings are quoted, not as easy legible.
Ignore such remarks; he has yet to grow up. Evidently there is plenty
of time for that; but alas no progress.
The correct, agreed situation is described in the RFCs and allied
documents; they are authoritative, unlike pointy-head.
--
© John Stockton, Surrey, UK. ?@merlyn.demon. co.uk Turnpike v4.00 IE 4 ©
<URL:http://jibbering.com/faq/> Jim Ley's FAQ for news:comp.lang. javascript
<URL:http://www.merlyn.demo n.co.uk/js-index.htm> jscr maths, dates, sources.
<URL:http://www.merlyn.demo n.co.uk/> TP/BP/Delphi/jscr/&c, FAQ items, links. This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: Randell D. |
last post by:
Folks,
I'm still learning javascript - I've invested in a couple of books and
reading online as much as possible. I'm pretty sure what I am suggesting is
possible though I'm trying to weigh up the faults that might go with the
suggestion... all opinions welcome.
My question: I have a list of links that go to pages that have a similar
layout. Could I have a text swap, similar to what I've seen with image swaps
(or an image switch)...
|
by: Geoff Soper |
last post by:
I'm trying to get some text to lie to the right of an image. If the text is
deeper than the image I want the text to continue with its left margin
following the line projected down from the right of the image, not to flow
underneath the image as with a float:left. I've achieved this with a table
at http://alphaworks.co.uk/imagetest/test.html (top and middle image / text
pairs) where I've also attempted to achieve it with CSS (bottom image /...
|
by: Keith Smith |
last post by:
How can I change the background IMAGE (not just color) of a CELL in a table?
I know that I can do this using CSS, but I really need to be able to do it
using JavaScript. Anyone know how?
Must be able to change the image for each cell - not the whole table.
Please help.
|
by: Sanjeeva Reddy |
last post by:
hai Anti Keskinen,
i have used
the following code MyListView->LargeImageList->ImageSize = gcnew
System::Drawing::Size(100,
100); // Sets large image size to 100, 100
here i am getting error like "gcnew is undeclared error",how to deeclare
'gcnew"
and when i am using in runtime to change the size of images in imagelist in
listview control in .net(forms application) by chnging one trckbar(like
tb1->Value),
|
by: Charles |
last post by:
Hello Everyone,
I have been gettting great feedback from microsoft.public.vc.language
group but after doing more searching I think my post should be directed
to this group.
I am trying to make a simple gif animation using VC++ and 13 different
gif files and a timer.
I am new to VC++ but played around with C++ for a few years. I am
using Microsoft Visual Studio 2005 (VC++).
| |
by: Karl |
last post by:
Hi,
Ok so on a given page I have 4 text links:
see it in black
see it in blue
see it in red
see it in green
using the standard swap image behavior, clicking on one of the above links
|
by: Zoro |
last post by:
My task is to read html files from disk and save them onto SQL Server
database field. I have created an nvarchar(max) field to hold them.
The problem is that some characters, particularly html entities, and
French/German special characters are lost and/or replaced by a
question mark.
This is really frustrating. I have tried using StreamReader with ALL
the encodings available and none work correctly. Each encoding handles
some characters...
|
by: David Stone |
last post by:
I have a simple question about the alt content of area elements
within an image map: is it redundant to include phrases such as
"link to..." or "jump to..."? My initial thought is 'yes', since
the area element implies a link to some other item or page location,
but would like to hear what others think.
If it helps at all, the page which prompted me to ask the question
is this one:
...
|
by: windandwaves |
last post by:
Hi Folk and Gurus
This may help some of you (though probably not the gurus), in changing
images:
http://www.sunnysideup.co.nz/j/imageChange/
Any feedback appreciated.
Cheers
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: jinu1996 |
last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth.
The Art of Business Website Design
Your website is...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: tracyyun |
last post by:
Dear forum friends,
With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: bsmnconsultancy |
last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...
| | |