Windows Vista Forums
Vista Forums Home Join Vista Forums Windows 7 Forum Vista Tutorials Tags
Welcome to Windows Vista Forums. Our forum is dedicated to helping you find solutions with any problems, errors or issues you are experiencing with Windows Vista. The Vista forum also covers news and updates and has an extensive Windows Vista tutorial section that covers a wide range of tips and tricks.

Go Back   Vista Forums > Misc Newsgroups > VB Script

Vista - How to change img scr in vbscript

Reply
 
Old 08-27-2009   #1 (permalink)
vqthomf


 
 

How to change img scr in vbscript

Hi I am trying to change the img scr in code by using the if document,
('Test').scr="vqsol_small.gif" then document("Test").scr="Newimg.gif"

<DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width : 400px">
<img NAME="Test" src="VQSol_Small.gif" width="80" height="50">
</DIV>

this wont work can someone tell me if this can be done in vbscript? if so
can someone help me please.
Regards

My System SpecsSystem Spec
Old 08-27-2009   #2 (permalink)
M Piceni


 
 

Re: How to change img scr in vbscript

Hi,

try changing NAME="Test" with ID="Test", then use:
If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"

Massimo.

"vqthomf" <vqthomf@xxxxxx> ha scritto nel messaggio
news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
Quote:

> Hi I am trying to change the img scr in code by using the if document,
> ('Test').scr="vqsol_small.gif" then document("Test").scr="Newimg.gif"
>
> <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width : 400px">
> <img NAME="Test" src="VQSol_Small.gif" width="80" height="50">
> </DIV>
>
> this wont work can someone tell me if this can be done in vbscript? if so
> can someone help me please.
> Regards

My System SpecsSystem Spec
Old 08-27-2009   #3 (permalink)
vqthomf


 
 

Re: How to change img scr in vbscript

the error I get is object doen't support this property or method: 'Test.scr'
Thanks for your help

"M Piceni" wrote:
Quote:

> Hi,
>
> try changing NAME="Test" with ID="Test", then use:
> If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
>
> Massimo.
>
> "vqthomf" <vqthomf@xxxxxx> ha scritto nel messaggio
> news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
Quote:

> > Hi I am trying to change the img scr in code by using the if document,
> > ('Test').scr="vqsol_small.gif" then document("Test").scr="Newimg.gif"
> >
> > <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width : 400px">
> > <img NAME="Test" src="VQSol_Small.gif" width="80" height="50">
> > </DIV>
> >
> > this wont work can someone tell me if this can be done in vbscript? if so
> > can someone help me please.
> > Regards
>
>
>
My System SpecsSystem Spec
Old 08-27-2009   #4 (permalink)
ekkehard.horner


 
 

Re: How to change img scr in vbscript

vqthomf schrieb:
Quote:

> the error I get is object doen't support this property or method: 'Test.scr'
> Thanks for your help
>
> "M Piceni" wrote:
>
Quote:

>> Hi,
>>
>> try changing NAME="Test" with ID="Test", then use:
>> If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
>>
>> Massimo.
>>
>> "vqthomf" <vqthomf@xxxxxx> ha scritto nel messaggio
>> news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
Quote:

>>> Hi I am trying to change the img scr in code by using the if document,
>>> ('Test').scr="vqsol_small.gif" then document("Test").scr="Newimg.gif"
>>>
>>> <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width : 400px">
>>> <img NAME="Test" src="VQSol_Small.gif" width="80" height="50">
>>> </DIV>
>>>
>>> this wont work can someone tell me if this can be done in vbscript? if so
>>> can someone help me please.
>>> Regards
>>
>>
try Test.src
My System SpecsSystem Spec
Old 08-27-2009   #5 (permalink)
vqthomf


 
 

Re: How to change img scr in vbscript

I have tried this and I still get the same error, what I am trying to do is
we have a submit button to copy file from a server to a small handheld sort
of laptop which is working but it is slow I need to indicate that it is
working. I was going to show an moving image and the file copy has finished
show blank image.
Regards

"ekkehard.horner" wrote:
Quote:

> vqthomf schrieb:
Quote:

> > the error I get is object doen't support this property or method: 'Test.scr'
> > Thanks for your help
> >
> > "M Piceni" wrote:
> >
Quote:

> >> Hi,
> >>
> >> try changing NAME="Test" with ID="Test", then use:
> >> If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
> >>
> >> Massimo.
> >>
> >> "vqthomf" <vqthomf@xxxxxx> ha scritto nel messaggio
> >> news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
> >>> Hi I am trying to change the img scr in code by using the if document,
> >>> ('Test').scr="vqsol_small.gif" then document("Test").scr="Newimg.gif"
> >>>
> >>> <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width : 400px">
> >>> <img NAME="Test" src="VQSol_Small.gif" width="80" height="50">
> >>> </DIV>
> >>>
> >>> this wont work can someone tell me if this can be done in vbscript? if so
> >>> can someone help me please.
> >>> Regards
> >>
> >>
> try Test.src
>
My System SpecsSystem Spec
Old 08-27-2009   #6 (permalink)
MassimoP


 
 

Re: How to change img scr in vbscript

vqthomf wrote:
Quote:

> the error I get is object doen't support this property or method:
> 'Test.scr' Thanks for your help
>
> "M Piceni" wrote:
>
Quote:

> > Hi,
> >
> > try changing NAME="Test" with ID="Test", then use:
> > If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
> >
> > Massimo.
> >
> > "vqthomf" <vqthomf@xxxxxx> ha scritto nel
> > messaggio news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
Quote:

> > > Hi I am trying to change the img scr in code by using the if
> > > document, ('Test').scr="vqsol_small.gif" then
> > > document("Test").scr="Newimg.gif"
> > >
> > > <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width :
> > > 400px"> <img NAME="Test" src="VQSol_Small.gif" width="80"
> > > height="50"> </DIV>
> > >
> > > this wont work can someone tell me if this can be done in
> > > vbscript? if so can someone help me please.
> > > Regards
> >
> >
> >
Quite strange, is working for me. My complete HTML file
follows:

<html>
<head>
<title>Test</title>
</head>

<script Language="VBScript">
Sub BImg_OnClick
If InStr(Test.src,"pic1.gif") Then
Test.src="pic2.gif"
Else
Test.src="pic1.gif"
End If
End Sub
</script>

<body>
<input type="button" value="ChImg" name="BImg"><br><br>
<img id="Test" src="pic1.gif">
</body>
</html>

Clicking on the ChImg button cycles between the 2 images.

- First note: use the InStr instead of = because, despite
how you write it, the SRC property always returns full
path.

-Second Note: be sure not to use TEST as an ID for any
othe element in the HTML page. This will not cause any
evident error, but the behaviour is unpredictable.

Massimo.
--

My System SpecsSystem Spec
Old 08-27-2009   #7 (permalink)
vqthomf


 
 

Re: How to change img scr in vbscript

That worked Thanks for your help it's much appreciated.
Regards

"MassimoP" wrote:
Quote:

> vqthomf wrote:
>
Quote:

> > the error I get is object doen't support this property or method:
> > 'Test.scr' Thanks for your help
> >
> > "M Piceni" wrote:
> >
Quote:

> > > Hi,
> > >
> > > try changing NAME="Test" with ID="Test", then use:
> > > If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
> > >
> > > Massimo.
> > >
> > > "vqthomf" <vqthomf@xxxxxx> ha scritto nel
> > > messaggio news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
> > > > Hi I am trying to change the img scr in code by using the if
> > > > document, ('Test').scr="vqsol_small.gif" then
> > > > document("Test").scr="Newimg.gif"
> > > >
> > > > <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px; Width :
> > > > 400px"> <img NAME="Test" src="VQSol_Small.gif" width="80"
> > > > height="50"> </DIV>
> > > >
> > > > this wont work can someone tell me if this can be done in
> > > > vbscript? if so can someone help me please.
> > > > Regards
> > >
> > >
> > >
>
> Quite strange, is working for me. My complete HTML file
> follows:
>
> <html>
> <head>
> <title>Test</title>
> </head>
>
> <script Language="VBScript">
> Sub BImg_OnClick
> If InStr(Test.src,"pic1.gif") Then
> Test.src="pic2.gif"
> Else
> Test.src="pic1.gif"
> End If
> End Sub
> </script>
>
> <body>
> <input type="button" value="ChImg" name="BImg"><br><br>
> <img id="Test" src="pic1.gif">
> </body>
> </html>
>
> Clicking on the ChImg button cycles between the 2 images.
>
> - First note: use the InStr instead of = because, despite
> how you write it, the SRC property always returns full
> path.
>
> -Second Note: be sure not to use TEST as an ID for any
> othe element in the HTML page. This will not cause any
> evident error, but the behaviour is unpredictable.
>
> Massimo.
> --
>
>
My System SpecsSystem Spec
Old 08-27-2009   #8 (permalink)
MassimoP


 
 

Re: How to change img scr in vbscript

vqthomf wrote:
Quote:

> That worked Thanks for your help it's much appreciated.
> Regards
>
> "MassimoP" wrote:
>
Quote:

> > vqthomf wrote:
> >
Quote:

> > > the error I get is object doen't support this property or method:
> > > 'Test.scr' Thanks for your help
> > >
> > > "M Piceni" wrote:
> > >
> > > > Hi,
> > > >
> > > > try changing NAME="Test" with ID="Test", then use:
> > > > If Test.scr="vqsol_small.gif" Then Test.scr="Newimg.gif"
> > > >
> > > > Massimo.
> > > >
> > > > "vqthomf" <vqthomf@xxxxxx> ha scritto nel
> > > > messaggio
> > > > news:68898DC2-5956-499A-877A-AF604349EC69@xxxxxx
> > > > > Hi I am trying to change the img scr in code by using the if
> > > > > document, ('Test').scr="vqsol_small.gif" then
> > > > > document("Test").scr="Newimg.gif"
> > > > >
> > > > > <DIV STYLE="Position : Absolute ;Left: 320px; Top : 01px;
> > > > > Width : 400px"> <img NAME="Test" src="VQSol_Small.gif"
> > > > > width="80" height="50"> </DIV>
> > > > >
> > > > > this wont work can someone tell me if this can be done in
> > > > > vbscript? if so can someone help me please.
> > > > > Regards
> > > >
> > > >
> > > >
> >
> > Quite strange, is working for me. My complete HTML file
> > follows:
> >
> > <html>
> > <head>
> > <title>Test</title>
> > </head>
> >
> > <script Language="VBScript">
> > Sub BImg_OnClick
> > If InStr(Test.src,"pic1.gif") Then
> > Test.src="pic2.gif"
> > Else
> > Test.src="pic1.gif"
> > End If
> > End Sub
> > </script>
> >
> > <body>
> > <input type="button" value="ChImg" name="BImg"><br><br>
> > <img id="Test" src="pic1.gif">
> > </body>
> > </html>
> >
> > Clicking on the ChImg button cycles between the 2 images.
> >
> > - First note: use the InStr instead of = because, despite
> > how you write it, the SRC property always returns full
> > path.
> >
> > -Second Note: be sure not to use TEST as an ID for any
> > othe element in the HTML page. This will not cause any
> > evident error, but the behaviour is unpredictable.
> >
> > Massimo.
> > --
> >
> >
I think also your original script should run, simply you
wrote SCR instead of SRC. Sorry, I didn't notice before,
and also dummy copied in my first post, so that also my
"solution" was affected by the same bug :-(
Ekkehard.Horner made me notice it.

Massimo.

--

My System SpecsSystem Spec
Reply

Thread Tools


Similar Threads
Thread Forum
Change a Javascript code to VBScript VB Script
VBScript to Change only "maximum password age" in Local User Accou VB Script
How to do No hang up VBScript (nohup for VBScript) VB Script
Column Settings in Windows Live Mail Folders - change one, change Live Mail
Change IDE to AHCI, is seen as harware change, so reactivate Vista Vista account administration


Vista Forums is an independent web site and has not been authorized,
sponsored, or otherwise approved by Microsoft Corporation.
"Windows Vista", the Start Orb, and related materials are trademarks of Microsoft Corp.
© Designer Media Ltd

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46