| |

VerySource

 Forgot password?
 Register
Search
View: 792|Reply: 2

(BHO) How to modify web content

[Copy link]

4

Threads

5

Posts

6.00

Credits

Newbie

Rank: 1

Credits
6.00

 China

Post time: 2020-9-25 18:00:02
| Show all posts |Read mode
When working on an Internet cafe advertising system, you need to add the advertising code in IE. What method can be used to modify the content of the webpage, thank you very much, the original innerHtml is used, but the original webpage code will be overwritten.
Reply

Use magic Report

0

Threads

2

Posts

3.00

Credits

Newbie

Rank: 1

Credits
3.00

 China

Post time: 2020-9-27 19:30:01
| Show all posts
You can add new things through the document object, such as document.createElement

<SCRIPT>
function fnCreate(){
    oData.innerHTML="";
    var oOption=oSel.options[oSel.selectedIndex];
    if(oOption.text.length>0){
    var aElement=document.createElement(oOption.text);
    eval("aElement." + oOption.value + "='" + oText.value + "'");
    if(oOption.text=="A"){
        aElement.href="javascript:alert('A link.')";
   }
   }
    oData.appendChild(aElement);
}
</SCRIPT>
<SELECT ID="oSel" onchange="fnCreate()">
<OPTION VALUE="innerText">A
<OPTION VALUE="value">&lt;INPUT TYPE="button"&gt;
</SELECT>
<INPUT TYPE="text" ID="oText" VALUE="Sample Text">
<SPAN ID="oData" ></SPAN>
Reply

Use magic Report

0

Threads

21

Posts

15.00

Credits

Newbie

Rank: 1

Credits
15.00

 China

Post time: 2020-9-27 19:45:01
| Show all posts
You will receive a window object in your implementation of IDispatch.Invoke, when the DocumentComplete event is fired (http://support.microsoft.com/kb/180366).

call
document.parentWindow.execScript(MY_SCRIPT_AS_STRING,'JavaScript');
Reply

Use magic Report

You have to log in before you can reply Login | Register

Points Rules

Contact us|Archive|Mobile|CopyRight © 2008-2023|verysource.com ( 京ICP备17048824号-1 )

Quick Reply To Top Return to the list