Gmail Calendar Documents Reader Web more »
Recently Visited Groups | Help | Sign in
Google Groups Home
Overwritting
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  8 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
Steve  
View profile  
 More options Nov 15 2009, 9:44 pm
Newsgroups: microsoft.public.scripting.vbscript
From: Steve <St...@discussions.microsoft.com>
Date: Sun, 15 Nov 2009 13:44:07 -0800
Local: Sun, Nov 15 2009 9:44 pm
Subject: Overwritting
I have a little VBScript program embedded into a web page that displays
hyperlinks but it overwites what was on the web page previous to running the
script, how do I stop it overwrite what was previously on the page? script
below

document.WriteLN("<a href=http://www.google.com >Google</a href><br />")

Thanks, Steve


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Evertjan.  
View profile  
 More options Nov 15 2009, 10:03 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Evertjan." <exjxw.hannivo...@interxnl.net>
Date: 15 Nov 2009 22:03:48 GMT
Local: Sun, Nov 15 2009 10:03 pm
Subject: Re: Overwritting
=?Utf-8?B?U3RldmU=?= wrote on 15 nov 2009 in
microsoft.public.scripting.vbscript:

> I have a little VBScript program embedded into a web page that
> displays hyperlinks but it overwites what was on the web page previous
> to running the script, how do I stop it overwrite what was previously
> on the page? script below

> document.WriteLN("<a href=http://www.google.com >Google</a href><br
> />")

You cannot do a document.write when the page is loaded without doing an
implicit document.open and so destroying the page as it was.

btw:
1 the () are not needed and should be discouraged in a VBS statement.
2 </a href> is nonsense html, try </a>
3 <br /> is xhtml, use <br> for html.
4 use quotes <a href='http://www.google.com'>
5 document.writeln only differs from document.write,
that it gives a new line in the html source,
having no effect on the rendered page.

==============

Whan you want to write something with clientside code into a page, you
should write it into an element with innerHTML, or appensd it to an
element with DOM manipulation.

Using vbs will only work in IE and not in any other browser, so it will
be a very defunct webpage. Why not use JavaScript instead?

<div id='links'></div>

<script type='text/javascript'>
  var links = document.getElementById('links');
  links.innerHTML = "<a href='http://google.com'>Google</a><br>";
</script>

With my appologies to this VBS-NG. ;-)

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Nov 16 2009, 1:54 am
Newsgroups: microsoft.public.scripting.vbscript
From: Steve <St...@discussions.microsoft.com>
Date: Sun, 15 Nov 2009 17:54:01 -0800
Local: Mon, Nov 16 2009 1:54 am
Subject: Re: Overwritting
Hi Evertjan,

Thanks for your reply. I dont know anything about Javascript so I cant
re-write the rest of the script.
What web element should I write to? I tried writing to a text box but it
just came out as text rather than a hyperlink

Regards, Steve


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Csaba Gabor  
View profile  
 More options Nov 16 2009, 8:54 am
Newsgroups: microsoft.public.scripting.vbscript
From: Csaba Gabor <dans...@gmail.com>
Date: Mon, 16 Nov 2009 00:54:04 -0800 (PST)
Local: Mon, Nov 16 2009 8:54 am
Subject: Re: Overwritting
On Nov 15, 10:44 pm, Steve <St...@discussions.microsoft.com> wrote:

> I have a little VBScript program embedded into a web page that displays
> hyperlinks but it overwites what was on the web page previous to running the
> script, how do I stop it overwrite what was previously on the page? script
> below

> document.WriteLN("<a href=http://www.google.com>Google</a href><br />")

This script below shows two ways to append your links.

Set newLink = document.createElement("A")
newLink.href = "http://google.com"
newLink.innerText = "My link to Google"
document.body.appendChild newLink

document.body.innerHTML = document.body.innerHTML & _
  "<br><a href='http://ebay.com'>My link to eBay</a>"

The first way (first 4 lines) is the "more proper" way.
The reason is because the second way can overwrite
other things you may have done with your web page.
For example, you will get an error if you append the
following line to the code above:

MsgBox newLink.parentNode.outerHTML

since the act of rewriting the body, wipes out variables
and event handlers and some other modifications that
may have been set because the entire DOM is redone.

Csaba Gabor from Vienna


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Evertjan.  
View profile  
 More options Nov 16 2009, 1:04 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "Evertjan." <exjxw.hannivo...@interxnl.net>
Date: 16 Nov 2009 13:04:58 GMT
Local: Mon, Nov 16 2009 1:04 pm
Subject: Re: Overwritting
=?Utf-8?B?U3RldmU=?= wrote on 16 nov 2009 in
microsoft.public.scripting.vbscript:

> Thanks for your reply. I dont know anything about Javascript so I cant
> re-write the rest of the script.
> What web element should I write to? I tried writing to a text box but it
> just came out as text rather than a hyperlink

[Please do not toppost on usenet]

The vbs answer comes from Vienna.

However,
either you do not mind to have a non-IE disfunctional webpage or you do.

If you do, better learn to use javascript.

--
Evertjan.
The Netherlands.
(Please change the x'es to dots in my emailaddress)


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
mayayana  
View profile  
 More options Nov 16 2009, 3:04 pm
Newsgroups: microsoft.public.scripting.vbscript
From: "mayayana" <mayaXXy...@rcXXn.com>
Date: Mon, 16 Nov 2009 10:04:24 -0500
Local: Mon, Nov 16 2009 3:04 pm
Subject: Re: Overwritting
   In addition to the other ideas, you might want to
look into insertAdjacentHTML. That method
allows you to add new HTML in relation to any
object. If you assign IDs to objects then it's
easy to call.
  Also, createTextRange and the TextRange object
provide ways to add or edit text.

   I don't know whether these methods are the same
in the DOM used by Firefox/Opera, but if you're only
using VBS with IE you don't need to worry about that.


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Nov 17 2009, 5:53 am
Newsgroups: microsoft.public.scripting.vbscript
From: Steve <St...@discussions.microsoft.com>
Date: Mon, 16 Nov 2009 21:53:14 -0800
Local: Tues, Nov 17 2009 5:53 am
Subject: Re: Overwritting
Hi Csaba,

Great thanks for that.
The script may need to display two or more hyperlinks down the page, how do
I display the second and third ones? I tried the following line but it came
up with an error?

Set newLink = document.createElement("B")

Regards, Steve


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Steve  
View profile  
 More options Nov 17 2009, 6:11 am
Newsgroups: microsoft.public.scripting.vbscript
From: Steve <St...@discussions.microsoft.com>
Date: Mon, 16 Nov 2009 22:11:04 -0800
Local: Tues, Nov 17 2009 6:11 am
Subject: Re: Overwritting
Hi Csaba,

Great thanks for that.

Regards, Steve


    Forward  
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »

Create a group - Google Groups - Google Home - Terms of Service - Privacy Policy
©2010 Google