473,786 Members | 2,375 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

getting 'has no properties' error with document.write( )....

function saveState() {
document.write (" | <a href = 'myhomepage.asp ?
view=mhp&amp;ac tion=save&amp;p b=");
document.write (document.phone .style.display. value);

document.write ("'>save view</a>");

};
creates an error at this (>) line.

function showhide (item) {
var objid = document.getEle mentById(item);
var imgid = document.getEle mentById(item+' i');
var imgidMinusSrc = '/images/furniture/minus.gif';
var imgidPlusSrc = '/images/furniture/plus2.gif';
if (objid.style.di splay == 'inline') {
objid.style.dis play = 'none';
imgid.src = imgidPlusSrc;
if (item == 'hpleftcolhl') {
objid.style.wid th = '4px';
document.getEle mentById('hplef tcol').style.wi dth = '6px';
document.getEle mentById('showt ime').style.dis play =
'none';
}
}
else {
objid.style.dis play = 'inline';
imgid.src = imgidMinusSrc;
if (item == 'hpleftcolhl') {
objid.style.wid th = '160px';
document.getEle mentById('hplef tcol').style.wi dth =
'160px';
document.getEle mentById('showt ime').style.dis play =
'inline';
}
}
};
this one however works fine, and both use the same object?
I've tried using document.getEle mentById('phone ').style.displa y
but with same result.

now, the saveState function is simply some inline script to build an <a
href> , whereas the showhide one is triggered from an onclick.
Jul 23 '05 #1
5 1750


s_m_b wrote:
function saveState() {
document.write (" | <a href = 'myhomepage.asp ?
view=mhp&amp;ac tion=save&amp;p b=");
document.write (document.phone .style.display. value);


document.write ("'>save view</a>");

};
creates an error at this (>) line.


If the function is executed after the page has been loaded the first
document.write clears the existing page and then document.phone does no
longer exist. Thus the problem is likely that you use document.write
after the page has been loaded.

--

Martin Honnen
http://JavaScript.FAQTs.com/
Jul 23 '05 #2
Lee
s_m_b said:

function saveState() {
document.write (" | <a href = 'myhomepage.asp ?
view=mhp&amp;a ction=save&amp; pb=");
document.write (document.phone .style.display. value);

document.write ("'>save view</a>");

};
creates an error at this (>) line.


document.write( ) clears the current contents of the document,
so by that second line, document.phone no longer exists.

Jul 23 '05 #3
Lee <RE************ **@cox.net> wrote in news:d0******** *@drn.newsguy.c om:
s_m_b said:

function saveState() {
document.write (" | <a href = 'myhomepage.asp ?
view=mhp&amp; action=save&amp ;pb=");
document.write (document.phone .style.display. value);

document.write ("'>save view</a>");

};
creates an error at this (>) line.


document.write( ) clears the current contents of the document,
so by that second line, document.phone no longer exists.


hum.....
would window.document .url = ...
be an alternative for getting the page to reload?
Jul 23 '05 #4
In article <Xn************ *************** *******@216.196 .97.138>,
sm********@hotm ail.com enlightened us with...

hum.....
would window.document .url = ...
be an alternative for getting the page to reload?


Reloading will also wipe your variables. In fact, it wipes everything and
gets the page fresh.

But if you want it:
window.location .reload();

--
--
~kaeli~
Time flies like an arrow. Fruit flies like a banana.
http://www.ipwebdesign.net/wildAtHeart
http://www.ipwebdesign.net/kaelisSpace

Jul 23 '05 #5
s_m_b wrote:
Lee <RE************ **@cox.net> wrote in news:d0******** *@drn.newsguy.c om:

s_m_b said:
function saveState() {
document.write (" | <a href = 'myhomepage.asp ?
view=mhp&amp ;action=save&am p;pb=");

> document.write (document.phone .style.display. value);

document.write ("'>save view</a>");

};
creates an error at this (>) line.


document.writ e() clears the current contents of the document,
so by that second line, document.phone no longer exists.

hum.....
would window.document .url = ...
be an alternative for getting the page to reload?


It seems that you are trying to create a URL based on current
page settings for the user to click on. If that is the case,
then use DOM methods to write the link, not document.write.

Alternatively, create your HTML as one string, then write the
entire thing in one go so that by the time document.write clears
the page, you've already used your in-page values:
var aHTML = ' | <a href = "myhomepage.asp ?'
+ 'view=mhp&amp;a ction=save&amp; pb='
+ document.phone. style.display.v alue
+ '">save view</a' + '>';
document.write( aHTML);

--
Rob
Jul 23 '05 #6

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

Similar topics

6
22535
by: Martin | last post by:
I'd like to be able to get the name of an object instance from within a call to a method of that same object. Is this at all possible? The example below works by passing in the name of the object instance (in this case 'myDog'). Of course it would be better if I could somehow know from within write() that the name of the object instance was 'myDog' without having to pass it as a parameter. //////////////////////////////// function...
7
5853
by: GfxGuy | last post by:
I've seen this problem posted a million times, but I've read through all of them and can't figure out what I'm doing wrong. Simple example (this is the whole file, no editing): ---------- <!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01//EN" "http://www.w3.org/TR/html4/strict.dtd"> <html>
12
1811
by: Adam Lipscombe | last post by:
Folks, I need to get the contents of a form attribute. In Read/Write mode this is field, so I can use getElementById("name").value In ReadOnly this is just plain text, so I can use getElementById("name").innerText. I need to do it dynamically though, so is there anyway I can look at the object returned by getElementById() and determine if it was a field or a
28
2100
by: Stefan Mueller | last post by:
I can display the value of the following input box with alert(parent.MyFrame.document.MyForm.MyInput.value); But if the frame, the form or the input box doesn't exist I get of course an error message. How can I figure out before I display the value if the frame 'MyFrame', the form 'MyForm' and also the input box 'MyInput' exists without getting an error message? Stefan
1
2312
by: rajesh | last post by:
var fixedX = -1 // x position (-1 if to appear below control) var fixedY = -1 // y position (-1 if to appear below control) var startAt = 0 // 0 - sunday ; 1 - monday var showWeekNumber = 0 // 0 - don't show; 1 - show var showToday = 1 // 0 - don't show; 1 - show var imgDir = "images/" // directory for images ... e.g. var imgDir="/img/" var gotoString = "Go To Current Month" var todayString = "Today is"
2
4222
by: MSK | last post by:
Hi, Continued to my earlier post regaring "Breakpoints are not getting hit" , I have comeup with more input this time.. Kindly give me some idea. I am a newbie to .NET, recently I installed .NET. I could not debug using breakpoints, breakpoints are not getting hit, but the application is working fine with out any issue.
6
4420
by: =?Utf-8?B?dGhsMTAwMA==?= | last post by:
Hi NG, i need to list the logonHours for a specific user. I'm trying to convert code from vbscript (is working) to vb.net, but the vb.net code does not work. Here are the code listings: 1: vbscript:
6
11024
by: DRS.Usenet | last post by:
When I run alert("page contents:" + content.document.documentElement.innerHTML); I am able to pull the content. I see something like this page contents:<head><title>A Title</title> <FRAMESET ROWS="75,*">
5
1115
by: Locke | last post by:
Hi, What is the correct way to get the dimensions of the displayable window? I.e. I don't want the border or the toolbar to be included in the height or width. I want to request an image from a php page by passing arguments for height and width so that will be rendered to fit exactly in the window. Thanks for any help.
0
9647
marktang
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...
0
10163
jinu1996
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...
1
10108
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,...
0
9960
tracyyun
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...
0
8988
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
1
7510
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
5532
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
4064
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
3
2894
bsmnconsultancy
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...

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.