When the JS file is called, The system prompts that the object cannot be found.

Source: Internet
Author: User
A netizen raised the following question today:
<SCRIPT type = "text/JavaScript">
VaR arrbaiducproconfig = new array ();
Arrbaiducproconfig ['uids '] = 388590;
Arrbaiducproconfig ['n'] = 'stockcity _ CPR ';
Arrbaiducproconfig ['TT'] = '40 ';
Arrbaiducproconfig ['cm'] = '000000 ';
Arrbaiducproconfig ['Um '] = '40 ';
Arrbaiducproconfig ['W'] = '000000 ';
Arrbaiducproconfig ['H'] = '54 ';
Arrbaiducproconfig ['wn '] = '1 ';
Arrbaiducproconfig ['hn '] = '1 ';
Arrbaiducproconfig ['ta '] = 'center ';
Arrbaiducproconfig ['tl '] = 'bottom ';
Arrbaiducproconfig ['Bu '] = '1 ';
Arrbaiducproconfig ['bd '] =' # trans ';
Arrbaiducproconfig ['bg '] =' # trans ';
Arrbaiducproconfig ['TT'] = '# 0000ff ';
Arrbaiducproconfig ['ct '] =' #444444 ';
Arrbaiducproconfig ['url'] = '#008000 ';
Arrbaiducproconfig ['bdl'] = '#000000 ';
Arrbaiducproconfig ['rad '] = 1;
</SCRIPT>
<SCRIPT type = "text/JavaScript" charset = "GBK" src = "http://cpro.baidu.com/cpro/ui/ui.js">
</SCRIPT>
<SCRIPT type = "text/JavaScript">
<! --
Document. Write (baiducproiframe ());
-->
</SCRIPT>

Baidu's advertisementCodeIt cannot be placed on a static page and requires you to call this code using Js.

I will do this at the beginning:
Create a JS file named jscript1.js. Output Baidu's JS file: VaR Str =   "" ;
Str + =   " <SCRIPT type = \ " Text / Javascript \ " > \ N " ;
Str + =   " VaR arrbaiducproconfig = new array (); \ n " ;
Str + =   " Arrbaiducproconfig ['uid'] = 388590; \ n " ;
Str + =   " Arrbaiducproconfig ['n'] = 'stockcity _ CPR '; \ n " ;
Str + =   " Arrbaiducproconfig ['Tm '] = '40'; \ n " ;
Str + =   " Arrbaiducproconfig ['cm'] = '000000'; \ n " ;
Str + =   " Arrbaiducproconfig ['Um '] = '40'; \ n " ;
Str + =   " Arrbaiducproconfig ['W'] = '000000'; \ n " ;
Str + =   " Arrbaiducproconfig ['H'] = '54'; \ n " ;
Str + =   " Arrbaiducproconfig ['wn '] = '1'; \ n " ;
Str + =   " Arrbaiducproconfig ['hn '] = '1'; \ n " ;
Str + =   " Arrbaiducproconfig ['ta '] = 'center'; \ n " ;
Str + =   " Arrbaiducproconfig ['tl '] = 'bottom'; \ n " ;
Str + =   " Arrbaiducproconfig ['Bu '] = '1'; \ n " ;
Str + =   " Arrbaiducproconfig ['bd '] =' # trans '; \ n " ;
Str + =   " Arrbaiducproconfig ['bg '] =' # trans '; \ n " ;
Str + =   " Arrbaiducproconfig ['TT'] = '# 0000ff'; \ n " ;
Str + =   " Arrbaiducproconfig ['ct '] =' #444444 '; \ n " ;
Str + =   " Arrbaiducproconfig ['url'] = '#008000'; \ n " ;
Str + =   " Arrbaiducproconfig ['bdl'] = '#000000'; \ n " ;
Str + =   " Arrbaiducproconfig ['rad '] = 1; \ n " ;
Str + =   " </SCRIPT> \ n " ;
Str + =   " <SCRIPT type = \ " Text / Javascript \ " Charset = \ " GBK \ " Src = \ " HTTP: // Cpro.baidu.com/cpro/ui/ui.js\ "> \ n ";
Str + =   " </SCRIPT> \ n " ;
Str + =   " <SCRIPT type = \ " Text / Javascript \ " > \ N " ;
// STR + = "<! -- \ N ";
Str + =   " Document. Write (baiducproiframe (); \ n " ;
// STR + = "--> \ n ";
Str + =   " </SCRIPT> \ n " ;
Document. Write (STR );



Then, on the home page, call:

< Html >
< Head >
< Title > Jscalljs </ Title >
< Script Language = " Javascript " SRC = " Jscript1.js " > </ Script >

</ Head >
< Body >
< Form ID = " Form1 " Method = " Post " Runat = " Server " >

</ Form >
</ Body >
</ Html >

It seems that there is no problem. But the result is an error: the object is missing!

After thinking about it for a long time, I finally figured out the path. This error seems to mean that I didn't actually call the file http://cpro.baidu.com/cpro/ui/ui.jsbefore calling baiducproiframe.
Therefore, manually copy the sentence and add it before the jscript1.js sentence on the homepage (Note: copy instead of cutting it out. This does not destroy the original code ).
Solve the problem !!!

The final situation of the home page is as follows: < Head >
< Title > Jscalljs </ Title >
< Script Type = "Text/JavaScript" Charset = "GBK" SRC = "Http://cpro.baidu.com/cpro/ui/ui.js" > </ Script >
< Script Language = "JavaScript" SRC = "Jscript1.js" > </ Script >

</ Head >

I don't know if you have any better solutions. I hope to discuss it here.

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.