MD
Tue Aug 22 09:48:17 CDT 2006
Never mind I see what you're doing.
--
Mike
http://www.websunlimited.com
FrontPage Add-in
MVP FrontPage '97 - '02
"MD Websunlimited" <none@none.com> wrote in message news:udBIIZfxGHA.4764@TK2MSFTNGP02.phx.gbl...
> I'm confused how does this have anything to do with the question asked?
>
> --
> Mike
>
http://www.websunlimited.com
> FrontPage Add-in
> MVP FrontPage '97 - '02
>
> "Trevor L." <Trevor_L.@Canberra> wrote in message news:O7wWtnbxGHA.5040@TK2MSFTNGP03.phx.gbl...
>> Xero wrote:
>>> hi. i want to assign different background image to a web page
>>> according to the query string in the URL. so i write this javascript
>>> ... thisURL = window.location;
>>> if (thisURL.indexOf('bio') != -1) {
>>> document.body.background = "bg2.jpg"
>>> }
>>>
>>>
>>> ... only to find that it doesn't work!
>>>
>>> what is wrong with it? thanks.
>>
>> To retrieve a query string use
>> function qsobj(parm)
>> {
>> var qpairs = document.location.search.substring(1).split("&")
>> var qvbl = qpairs[parm].split("=")
>> return qvbl[1] ? unescape(qvbl[1].replace(/%20|\ +/g," ")) : null
>> }
>>
>> So if you call the page as thepage.html?bgcol=bg2.jpg then the JS in thepage.html would be (not tested)
>> <head>
>>
>> <script type="text/javascript">
>> function qsobj(parm)
>> {
>> var qpairs = document.location.search.substring(1).split("&")
>> var qvbl = qpairs[parm].split("=")
>> return qvbl[1] ? unescape(qvbl[1].replace(/%20|\ +/g," ")) : null
>> } document.body.background = qsobj(0)
>> </script>
>>
>> </head>
>> --
>> Cheers,
>> Trevor L.
>> [ Microsoft MVP - FrontPage ]
>> MVPS Website:
http://trevorl.mvps.org/
>
>